You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I'm writing the cutting plane algorithm. I want to add constraints to cut the original solution.
I find that it is not supported to add constraints for the slack variables in Cylp. I find that Cylp Model only supports the CylpVar. Model.variables doesn't include slack variables, so I can't use CylpModel to add constraint.
And I find that CLP_addConstraint doesn't support slack variables, either.
This is the code
def CLP_addConstraint(self, numberInRow,
np.ndarray[np.int32_t, ndim=1] columns,
np.ndarray[np.double_t, ndim=1] elements,
rowLower,
rowUpper):
'''
Add a constraint to the problem, CLP style. See CLP documentation.
Not commonly used in cylp.
For cylp modeling tool see :mod:`cylp.python.modeling.CyLPModel`.
'''
# TODO: This makes adding a row real slower,
# but it is better than a COIN EXCEPTION!
if (columns >= self.nVariables).any():
raise Exception('CyClpSimplex.pyx:addConstraint: Column ' \
'index out of range (number of columns: ' \
'%d)' % (self.nVariables))
self.CppSelf.addRow(numberInRow, <int*>columns.data,
<double*>elements.data, rowLower, rowUpper)
If I comment the if lines and use slack variables in the constraint.
For a two variables problem, it will return an error.
model.CLP_addConstraint(4,np.array([0,1,2,3],dtype=np.dtype(np.int32)),np.array([1.,2.,3.,4.]),-10,10)
Column index out of range(number of columns 2)
If there are some difficulties, I will try to use original variables to represent the constraint like Cuppy.
The text was updated successfully, but these errors were encountered:
Hello, I'm writing the cutting plane algorithm. I want to add constraints to cut the original solution.
I find that it is not supported to add constraints for the slack variables in Cylp. I find that Cylp Model only supports the CylpVar. Model.variables doesn't include slack variables, so I can't use CylpModel to add constraint.
And I find that CLP_addConstraint doesn't support slack variables, either.
This is the code
If I comment the if lines and use slack variables in the constraint.
For a two variables problem, it will return an error.
If there are some difficulties, I will try to use original variables to represent the constraint like Cuppy.
The text was updated successfully, but these errors were encountered: