Skip to content

Multidimensional Knapsack Problem solver written in Scala

Notifications You must be signed in to change notification settings

uhef/nyyttipalvelin

Repository files navigation

Nyyttipalvelin is a Multidimensional Knapsack Problem solver written in Scala.
Implemented in Reaktor (www.reaktor.fi) algorithm code camp March, 2011.

Nyyttipalvelin listens for HTTP post requests that deliver the Knapsack
problem in JSON format. It uses Scalatra for HTTP protocol implementation.

The received request contains name of the challenge, timeout (in milliseconds)
in which the server has to respond to the request, list of items that can be
used to fill the knapsack with and the capacity of the knapsack. Each item
is composed of its id, its weight (dimensions) and its value.

Server aims to calculate a filled knapsack in which the total value of
included items is maximized while the total weights of the items do not
exceed the knapsack capacity on any dimension.

Server responds to the request and passes the solution in JSON as a list
of item ids that were selected into the knapsack.

Once server has received the Knapsack problem it launches algorithms to
calculate solutions to the problem. All algorithms are ran in parallel
leveraging Scala's actor - paradigm.

Some algorithms calculate one solution to the problem and return that
immediatelly to the controller actor while other algorithms (like the tabu
filler) improve their knapsack solutions for as long as they can sending
any new solutions that are better than their so far best result to the
controller actor.

Once the timeout that was passed in request is reached the controller actor
shuts down all algorithm actors that are still processing and return the
best received solution in the response.

About

Multidimensional Knapsack Problem solver written in Scala

Resources

Stars

Watchers

Forks

Packages

No packages published