pyepo.model.copt.knapsack ========================= .. py:module:: pyepo.model.copt.knapsack .. autoapi-nested-parse:: Knapsack problem Classes ------- .. autoapisummary:: pyepo.model.copt.knapsack.knapsackModel pyepo.model.copt.knapsack.knapsackModelRel Module Contents --------------- .. py:class:: knapsackModel(weights: numpy.ndarray | list, capacity: numpy.ndarray | list, *args, **kwargs) Bases: :py:obj:`pyepo.model.bases.knapsackBase`, :py:obj:`pyepo.model.copt.coptmodel.optCoptModel` COPT-backed knapsack. :ivar _model: COPT model :vartype _model: COPT model :ivar weights: weights of items :vartype weights: np.ndarray :ivar capacity: total capacity :vartype capacity: np.ndarray :ivar items: list of item index :vartype items: list .. py:method:: relax() -> knapsackModelRel A method to get linear relaxation model .. py:class:: knapsackModelRel(weights: numpy.ndarray | list, capacity: numpy.ndarray | list, *args, **kwargs) Bases: :py:obj:`knapsackModel` LP relaxation of the COPT knapsack. .. py:method:: relax() -> knapsackModelRel A forbidden method to relax MIP model