pyepo.model.omo.knapsack
Knapsack problem
Module Contents
Classes
This class is optimization model for knapsack problem |
|
This class is relaxed optimization model for knapsack problem. |
Attributes
- class pyepo.model.omo.knapsack.knapsackModel(weights, capacity, solver='glpk')
Bases:
pyepo.model.omo.omomodel.optOmoModel
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.omo.knapsack.knapsackModelRel(weights, capacity, solver='glpk')
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.omo.knapsack.cost