pyepo.model.copt.knapsack

Knapsack problem

Module Contents

Classes

knapsackModel

This class is optimization model for knapsack problem

knapsackModelRel

This class is relaxed optimization model for knapsack problem.

Attributes

cost

class pyepo.model.copt.knapsack.knapsackModel(weights, capacity)

Bases: pyepo.model.copt.coptmodel.optCoptModel

This class is optimization model for knapsack problem

_model

Pyomo model

Type:

PyOmo model

solver

optimization solver in the background

Type:

str

weights

weights of items

Type:

np.ndarray

capacity

total capacity

Type:

np.ndarray

items

list of item index

Type:

list

_getModel()

A method to build pyomo model

relax()

A method to get linear relaxation model

class pyepo.model.copt.knapsack.knapsackModelRel(weights, capacity)

Bases: knapsackModel

This class is relaxed optimization model for knapsack problem.

_getModel()

A method to build pyomo

relax()

A forbidden method to relax MIP model

pyepo.model.copt.knapsack.cost