README.md

AdvRLab6 knapsack problem with three different ways

Build Status AppVeyor build status

How to use:

```{r installation, eval = FALSE} devtools::install_github("nourqweder/AdvRLab6", build_vignettes = TRUE)


### 1.1.2 Brute force search

## *Question*:
### How much time does it takes to run the algorithm for n = 16 objects?

**Answer:**
```{r, echo=TRUE, eval=TRUE, message=FALSE}
system.time(brute_force_knapsack(x = knapsack_objects[1:16,], W = 3500))

```{r, echo=TRUE, eval=TRUE, message=FALSE} profvis(brute_force_knapsack(x = knapsack_objects[1:16,], W = 3500))



### 1.1.3 Dynamic Programming

## *Question*: 
### How much time does it takes to run the algorithm for n = 500 objects?
```{r, echo = TRUE, eval = FALSE, message = FALSE, results='asis'}
system.time(knapsack_dynamic(x = knapsack_objects[1:500,], W = 3500))

```{r, echo = TRUE, eval = FALSE, message = FALSE, results='asis'} profvis(knapsack_dynamic(x = knapsack_objects[1:500,], W = 3500))

**Answer:**


### 1.1.4 Greedy heuristic

## *Question*: 
### How much time does it takes to run the algorithm for n = 1000000 objects?

  ```{r, echo=TRUE, eval=FALSE, message=FALSE, results='asis'}
system.time(greedy_knapsack(x = knapsack_objects[1:1000000,], W = 3500))

Answer:

1.1.6 Profile your code and optimize your code

NOTE: Package lineprof is not available for R version 3.6.1, so we will use package profvis instead.

Check build status with

Reference

DataSet knapsack_objects



nourqweder/AdvRLab6 documentation built on Nov. 4, 2019, 10:09 p.m.