pyepo.model.opt

Abstract optimization model

Classes

optModel

This is an abstract class for an optimization model

unionFind

Union-Find data structure for cycle detection in graphs

Functions

_get_grid_arcs(grid)

Get list of arcs for a grid network.

Module Contents

class pyepo.model.opt.optModel

Bases: abc.ABC

This is an abstract class for an optimization model

_model

underlying solver model object

Type:

optimization model

__repr__()
property num_cost

number of costs to be predicted

abstract _getModel()

An abstract method to build a model from an optimization solver

Returns:

optimization model and variables

Return type:

tuple

abstract setObj(c)

An abstract method to set the objective function

Parameters:

c (ndarray) – cost of objective function

abstract solve()

An abstract method to solve the model

Returns:

optimal solution (list) and objective value (float)

Return type:

tuple

copy()

A method to copy the model

Returns:

new copied model

Return type:

optModel

abstract addConstr(coefs, rhs)

An abstract method to add a new constraint

Parameters:
  • coefs (ndarray) – coefficients of the new constraint

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

Returns:

new model with the added constraint

Return type:

optModel

relax()

An unimplemented method to relax the MIP model

class pyepo.model.opt.unionFind(n)

Union-Find data structure for cycle detection in graphs

parent
find(i)
union(i, j)
pyepo.model.opt._get_grid_arcs(grid)

Get list of arcs for a grid network.

Parameters:

grid (tuple of int) – size of grid network (rows, cols)

Returns:

arcs as (source, target) tuples

Return type:

list