pyepo.model.ort.ortcpmodel

Abstract optimization model based on Google OR-Tools CP-SAT

Attributes

_HAS_ORTOOLS

Classes

optOrtCpModel

This is an abstract class for an OR-Tools CP-SAT optimization model

Module Contents

pyepo.model.ort.ortcpmodel._HAS_ORTOOLS = True
class pyepo.model.ort.ortcpmodel.optOrtCpModel

Bases: pyepo.model.opt.optModel

This is an abstract class for an OR-Tools CP-SAT optimization model

_model

OR-Tools CP-SAT model

Type:

cp_model.CpModel

_OBJ_SCALE = 1000000
_extra_constrs = []
__repr__()
setObj(c)

A method to set the objective function

Parameters:

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

solve()

A 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

addConstr(coefs, rhs)

A method to add a new constraint

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

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

Returns:

new model with the added constraint

Return type:

optModel

relax()

CP-SAT does not support LP relaxation.