pyepo.model.mpax.knapsack

Knapsack problem

Attributes

_HAS_MPAX

cost

Classes

knapsackModel

This class is optimization model for relexed knapsack problem

Module Contents

pyepo.model.mpax.knapsack._HAS_MPAX = True
class pyepo.model.mpax.knapsack.knapsackModel(weights, capacity)

Bases: pyepo.model.mpax.mpaxmodel.optMpaxModel

This class is optimization model for relexed knapsack problem

_model

Gurobi model

Type:

GurobiPy model

weights

Weights of items

Type:

np.ndarray / list

capacity

Total capacity

Type:

np.ndarray / listy

items

List of item index

Type:

list

weights
capacity
items
_constructMatrix()

Constructs the inequality constraint matrix G, right-hand side h, and upper bound u for the knapsack problem.

Returns:

Weights of items h (jnp.ndarray): Total capacity u (jnp.ndarray): Upper bound for item selection

Return type:

G (jnp.ndarray)

pyepo.model.mpax.knapsack.cost