Skip to content

Commit

Permalink
Update README.md (registered package)
Browse files Browse the repository at this point in the history
Change the installation instructions since this is a registered package now. 

Also, a few minor spelling fixes and phrasing changes for better readability.
  • Loading branch information
digital-carver authored Oct 23, 2023
1 parent 3c73c09 commit 54f7180
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This package solves Knapsack Problems (KPs) using different algorithms.

## Usage

First, it defines the `Knapsack` type:
First, the package defines the `Knapsack` type:

```julia
struct Knapsack
Expand All @@ -20,15 +20,15 @@ struct Knapsack
end
```

Then, there are four available solvers, called from a single function which takes a `Knapsack`, and returns the optimal/best value and an `Array` with the selected items:
Then, there are four available solvers, called from a single function which takes a `Knapsack` instance, and returns the optimal/best value and an `Array` with the selected items:

```julia
function solveKnapsack(data::KnapsackData, algorithm::Symbol = :ExpandingCore; optimizer = nothing)
```

Where `algorithm` must be one of the following:

- `DynammicProgramming`: Solves KP using a naïve dynamic programming.
- `DynamicProgramming`: Solves KP using a naïve dynamic programming.
- `BinaryModel`: Solves KP using a binary programming model.
- `ExpandingCore`: Solves KP using Pisinger's expanding core algorithm.
- `Heuristic`: Solves KP using a simple heuristic.
Expand All @@ -38,15 +38,15 @@ Algorithm `BinaryModel` uses [JuMP](https://jump.dev/), and the user must pass t
For example, given a `Knapsack` instance `data`:

```julia
optimal, selected = solveKnapsack(data, :DynammicProgramming)
optimal, selected = solveKnapsack(data, :DynamicProgramming)
optimal, selected = solveKnapsack(data, :BinaryModel; optimizer = GLPK.Optimizer)
optimal, selected = solveKnapsack(data, :ExpandingCore)
value, selected = solveKnapsack(data, :Heuristic)
```

## Instance generator

The package is able to generate random instances with the following function (based on [this code](http://hjemmesider.diku.dk/~pisinger/generator.c)):
The package is able to generate random instances of `Knapsack` with the following function (based on [this code](http://hjemmesider.diku.dk/~pisinger/generator.c)):

```julia
function generateKnapsack(num_items::Int64, range::Int64 = 1000; type::Symbol = :Uncorrelated, seed::Int64 = 42, num_tests::Int64 = 1000)::Knapsack
Expand All @@ -62,12 +62,11 @@ Where:

## Installation

This package is *not* yet a registered Julia Package.
You can install Knapsacks through the Julia package manager.
This package is a registered Julia Package, and can be installed through the Julia package manager.
Open Julia's interactive session (REPL) and type:

```julia
] add https://github.com/rafaelmartinelli/Knapsacks.jl
] add Knapsacks
```

## Benchmark
Expand Down

0 comments on commit 54f7180

Please sign in to comment.