pyepo.model.copt.coptmodel ========================== .. py:module:: pyepo.model.copt.coptmodel .. autoapi-nested-parse:: Abstract optimization model based on Cardinal Optimizer (COPT) Classes ------- .. autoapisummary:: pyepo.model.copt.coptmodel.optCoptModel Module Contents --------------- .. py:class:: optCoptModel Bases: :py:obj:`pyepo.model.opt.optModel` Abstract base class for Cardinal Optimizer (COPT) backed models. Subclasses implement ``_getModel`` to build a COPT ``Model`` and return ``(model, variables)``. The objective sense is auto-detected from the underlying COPT model (no need to set ``modelSense`` manually); solver logging is silenced by default. Cost-vector updates use the C-level ``setInfo("Obj", ...)`` batch path for efficiency. A process-local COPT ``Envr`` singleton is reused across instances to avoid re-booting the license and worker threads on every model build. :ivar _model: underlying COPT model :vartype _model: coptpy.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 and objective value :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