pyepo.model.grb.grbmodel ======================== .. py:module:: pyepo.model.grb.grbmodel .. autoapi-nested-parse:: Abstract optimization model based on GurobiPy Classes ------- .. autoapisummary:: pyepo.model.grb.grbmodel.optGrbModel Module Contents --------------- .. py:class:: optGrbModel Bases: :py:obj:`pyepo.model.opt.optModel` Abstract base class for GurobiPy-backed optimization models. Subclasses implement ``_getModel`` to build a ``gurobipy.Model`` and return ``(model, variables)``. The objective sense is auto-detected from the underlying Gurobi model -- ``modelSense`` does not need to be set manually. Solver output is silenced by default; cost-vector updates use the C-level ``setAttr("Obj", ...)`` batch path for efficiency. :ivar _model: underlying Gurobi model :vartype _model: gurobipy.Model .. py:property:: num_cost :type: int number of costs to be predicted .. 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