cylp.cy.CyCoinModel

class cylp.cy.CyCoinModel.CyCoinModel
>>> import numpy as np
>>> from cylp.cy import CyCoinModel, CyClpSimplex
>>> m = CyCoinModel()
>>>
>>> m.addVariable(3, np.array(
...                 [0, 1, 2], np.int32),
...                 np.array([1., 1., 1.], np.double), 0, 10, 5)
>>>
>>> m.addVariable(2, np.array(
...                 [1,2], np.int32),
...                 np.array([5, 2.], np.double), 0, 10, 2)
>>>
>>> # Add bounds for the three constraints (we have two variables)
>>> m.setConstraintLower(0, 2.3)
>>> m.setConstraintLower(1, 4.5)
>>> m.setConstraintLower(0, 1.5)
>>>
>>> # Add a 4th constraint
>>> m.addConstraint(2,
...                     np.array([0, 1], np.int32),
...                     np.array([1., 1.], np.double), 2, 7)
>>>
>>> s = CyClpSimplex()
>>> # Load the problem from the CyCoinModel
>>> s.loadProblemFromCyCoinModel(m)
0
>>> s.primal()
'optimal'
>>> abs(s.objectiveValue - 8.7) < 10 ** -7
True
addConstraint(self, numberInRow, ndarray columns, ndarray elements, rowLower, rowUpper)
addVariable(self, numberInColumn, ndarray rows, ndarray elements, columnLower, columnUpper, objective)
getNumConstraints(self)
getNumVariables(self)
setConstraintLower(self, ind, val)
setConstraintUpper(self, ind, val)
setObjective(self, varInd, val)
setVariableLower(self, ind, val)
setVariableUpper(self, ind, val)