knapsack

package module
v0.0.0-...-6c2a988 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2018 License: GPL-3.0 Imports: 2 Imported by: 0

README

knapsack

Travis branch

Intorduction

The knapsack problem is an integer programming problem with boolean variables. We relax its binary variables with real numbers from 0 to 1 and solve the resulted non-convex problem by SCA methods.

Implementation has done in Go beacuase of its awesome performance and Cplex beacuse of its awesome features.

Cplex

After relaxing binary variables and add following constraint:

x^2 - x <= 0

We have non-convex problem, for solving this problem we use lagrangian method create following problem:

max sum_i=0^T x_i + mu * (x_i^2 - x_i)
sum_i=0^T x_i <= capacity

Again we approximate x^2 - x with its first order approximation and after that we have following LP problem. please note that x^n_i means x_i in nth iteration.

max sum_i=0^T x^n_i + mu * (2 * x^(n-1)_i - 1) * x^n_i
sum_i=0^T x^n_i <= capacity

Implementation of the above LP Problem can be found in /cplex.

Contributers

  • Parham Alvani (MSc Student of the Amirkabir University of Technology)
  • Bahador Bakhshi (Assistant Professor of the Amirkabir University of Technology)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Solve

func Solve(p problem.Problem) (*optimize.Result, error)

Solve solves given knapsack problem with gradient descent method

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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