pyepo.model.copt ================ .. py:module:: pyepo.model.copt .. autoapi-nested-parse:: Optimization Model based on Cardinal Optimizer(COPT) Submodules ---------- .. toctree:: :maxdepth: 1 /autoapi/pyepo/model/copt/coptmodel/index /autoapi/pyepo/model/copt/knapsack/index /autoapi/pyepo/model/copt/shortestpath/index Classes ------- .. autoapisummary:: pyepo.model.copt.optCoptModel pyepo.model.copt.shortestPathModel pyepo.model.copt.knapsackModel pyepo.model.copt.knapsackModelRel Package Contents ---------------- .. py:class:: optCoptModel Bases: :py:obj:`pyepo.model.opt.optModel` This is an abstract class for Cardinal Optimizer optimization model .. attribute:: _model COPT model :type: COPT model .. py:method:: __repr__() .. py:method:: setObj(c) A method to set objective function :param c: cost of objective function :type c: np.ndarray / list .. py:method:: solve() A method to solve model :returns: optimal solution (list) and objective value (float) :rtype: tuple .. py:method:: copy() A method to copy model :returns: new copied model :rtype: optModel .. py:method:: addConstr(coefs, rhs) A method to add new constraint :param coefs: coeffcients of new constraint :type coefs: np.ndarray / list :param rhs: right-hand side of new constraint :type rhs: float :returns: new model with the added constraint :rtype: optModel .. py:class:: shortestPathModel(grid) Bases: :py:obj:`pyepo.model.copt.coptmodel.optCoptModel` This class is optimization model for shortest path problem .. attribute:: _model Pyomo model :type: PyOmo model .. attribute:: solver optimization solver in the background :type: str .. attribute:: grid size of grid network :type: tuple of int .. attribute:: arcs list of arcs :type: list .. py:attribute:: grid .. py:attribute:: arcs :value: [] .. py:method:: _getArcs() A method to get list of arcs for grid network :returns: arcs :rtype: list .. py:method:: _getModel() A method to build pyomo model .. py:class:: knapsackModel(weights, capacity) Bases: :py:obj:`pyepo.model.copt.coptmodel.optCoptModel` This class is optimization model for knapsack problem .. attribute:: _model Pyomo model :type: PyOmo model .. attribute:: solver optimization solver in the background :type: str .. attribute:: weights weights of items :type: np.ndarray .. attribute:: capacity total capacity :type: np.ndarray .. attribute:: items list of item index :type: list .. py:attribute:: weights .. py:attribute:: capacity .. py:attribute:: items .. py:method:: _getModel() A method to build pyomo model .. py:method:: relax() A method to get linear relaxation model .. py:class:: knapsackModelRel(weights, capacity) Bases: :py:obj:`knapsackModel` This class is relaxed optimization model for knapsack problem. .. py:method:: _getModel() A method to build pyomo .. py:method:: relax() A forbidden method to relax MIP model