pyepo.model.ort.ortmodel ======================== .. py:module:: pyepo.model.ort.ortmodel .. autoapi-nested-parse:: Abstract optimization model based on Google OR-Tools (pywraplp) Classes ------- .. autoapisummary:: pyepo.model.ort.ortmodel.optOrtModel Module Contents --------------- .. py:class:: optOrtModel(solver: str = 'scip') Bases: :py:obj:`pyepo.model.opt.optModel` Abstract base class for OR-Tools pywraplp (LP/MIP) models. Subclasses implement ``_getModel`` to build a ``pywraplp.Solver`` and return ``(model, variables)``. Unlike ``optGrbModel``, the objective sense is **not** detected automatically -- set ``self.modelSense = EPO.MAXIMIZE`` in ``_getModel`` for maximization problems (default is minimization). Solver output is silenced by default. The backend solver is selected at construction time via the ``solver`` argument (e.g., ``"scip"``, ``"glop"``, ``"cbc"``). :ivar _model: underlying OR-Tools linear solver :vartype _model: pywraplp.Solver :ivar solver: pywraplp backend name :vartype solver: str .. py:attribute:: solver :value: 'scip' .. py:method:: get_config() -> dict Return the constructor configuration for this model. .. py:method:: setObj(c: numpy.ndarray | torch.Tensor | list) -> None A method to set the objective function :param c: cost of objective function .. py:method:: solve() -> tuple[numpy.ndarray, float] A method to solve the model :returns: optimal solution (list) and objective value (float) :rtype: tuple .. py:method:: copy() -> Self A method to copy the model :returns: new copied model :rtype: optModel .. py:method:: addConstr(coefs: numpy.ndarray | torch.Tensor | list, rhs: float) -> Self A method to add a new constraint :param coefs: coefficients of new constraint :param rhs: right-hand side of new constraint :returns: new model with the added constraint :rtype: optModel