Skip to content

Knapsack problem in Rust, solved by heuristic algorithm

Notifications You must be signed in to change notification settings

aso824/knapsack-rust

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Knapsack problem

Introduction

The knapsack problem goal is to reach the maximum value of items, from pool of available ones, in a limited cargo space.
This problem has been studied for more than one century and is classified as NP-complete.
Full description is available on Wikipedia

How to run this program

Set up newest Rust version using rustup and run main program:

cargo run data/small.json 15.00

Arguments:

  • data/small.json - input file with map of weights and values
  • 15.00 - maximum allowed weight

Output has same structure as input.

Data structures

Data stored in JSON, examples available in /data directory.
Input file should be JSON array with objects:

[
    {
        "weight": 12.0,
        "value": 4.0
    },
    ...
]

About

Knapsack problem in Rust, solved by heuristic algorithm

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages