pyepo.model.copt

Optimization Model based on Cardinal Optimizer(COPT)

Submodules

Package Contents

Classes

optCoptModel

This is an abstract class for Cardinal Optimizer optimization model

shortestPathModel

This class is optimization model for shortest path problem

knapsackModel

This class is optimization model for knapsack problem

knapsackModelRel

This class is relaxed optimization model for knapsack problem.

class pyepo.model.copt.optCoptModel

Bases: pyepo.model.opt.optModel

This is an abstract class for Cardinal Optimizer optimization model

_model

COPT model

Type:

COPT model

__repr__()

Return repr(self).

setObj(c)

A method to set objective function

Parameters:

c (np.ndarray / list) – cost of objective function

solve()

A method to solve model

Returns:

optimal solution (list) and objective value (float)

Return type:

tuple

copy()

A method to copy model

Returns:

new copied model

Return type:

optModel

addConstr(coefs, rhs)

A method to add new constraint

Parameters:
  • coefs (np.ndarray / list) – coeffcients of new constraint

  • rhs (float) – right-hand side of new constraint

Returns:

new model with the added constraint

Return type:

optModel

class pyepo.model.copt.shortestPathModel(grid)

Bases: pyepo.model.copt.coptmodel.optCoptModel

This class is optimization model for shortest path problem

_model

Pyomo model

Type:

PyOmo model

solver

optimization solver in the background

Type:

str

grid

size of grid network

Type:

tuple of int

arcs

list of arcs

Type:

list

_getArcs()

A method to get list of arcs for grid network

Returns:

arcs

Return type:

list

_getModel()

A method to build pyomo model

class pyepo.model.copt.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.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