knapsack

command
v0.25.0-dev.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 30, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

README

Nextmv knapsack template

Knapsack is a classic combinatorial optimization problem. Given a collection of items with a value and weight, our objective is to maximize the total value without exceeding the weight capacity of the knapsack.

This template uses our custom modelling framework store to model and solve such a packing problem.

The most important files created are main.go and input.json.

  • main.go implements a Knapsack solver.
  • input.json is a sample input file that follows the input definition in main.go.

Before you start customizing, run the command below to see if everything works as expected:

nextmv sdk run . -- -runner.input.path input.json \
  -runner.output.path output.json -limits.duration 10s

A file output.json should have been created with the optimal Knapsack solution

Next steps

Documentation

Overview

package main holds the implementation of the knapsack template.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL