cylp.cy.CyCoinModel

class cylp.cy.CyCoinModel.CyCoinModel[source]
>>> 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[int32_t,ndim=1], ndarray[double_t,ndim=1], rowLower, rowUpper)[source]
addVariable(self, numberInColumn, ndarray[int32_t,ndim=1], ndarray[double_t,ndim=1], columnLower, columnUpper, objective)[source]
getNumConstraints(self)[source]
getNumVariables(self)[source]
setConstraintLower(self, ind, val)[source]
setConstraintUpper(self, ind, val)[source]
setObjective(self, varInd, val)[source]
setVariableLower(self, ind, val)[source]
setVariableUpper(self, ind, val)[source]