pyepo.model.copt.coptmodel¶
Abstract optimization model based on Cardinal Optimizer (COPT)
Classes¶
Abstract base class for Cardinal Optimizer (COPT) backed models. |
Module Contents¶
- class pyepo.model.copt.coptmodel.optCoptModel¶
Bases:
pyepo.model.opt.optModelAbstract base class for Cardinal Optimizer (COPT) backed models.
Subclasses implement
_getModelto build a COPTModeland return(model, variables). The objective sense is auto-detected from the underlying COPT model (no need to setmodelSensemanually); solver logging is silenced by default. Cost-vector updates use the C-levelsetInfo("Obj", ...)batch path for efficiency. A process-local COPTEnvrsingleton is reused across instances to avoid re-booting the license and worker threads on every model build.- Variables:
_model (coptpy.Model) – underlying COPT model
- setObj(c: numpy.ndarray | torch.Tensor | list) None¶
A method to set the objective function
- Parameters:
c – cost of objective function
- solve() tuple[numpy.ndarray, float]¶
A method to solve the model
- Returns:
optimal solution and objective value
- Return type:
- addConstr(coefs: numpy.ndarray | torch.Tensor | list, rhs: float) Self¶
A method to add a new constraint
- Parameters:
coefs – coefficients of new constraint
rhs – right-hand side of new constraint
- Returns:
new model with the added constraint
- Return type: