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
I try to solve a problem with binary variable, F, and continuous variable, X.
The purpose of using variable F is to limit number of Xij from X to 40.
model = CyLPModel()
PARAMETERS/VARIABLES
M=1000000 # M is a very big number
X = model.addVariable('X', (2, 230))
F = model.addVariable('F', 230, isInt=True)
CONSTRAINS
model += 0 <= F <= 1 # I use this together with isInt=True parameter earlier to define F as a binary var. model += X >= 0.0
model += A * X >= B #A and B, are matrices with known values
model += F.sum() <= 40
for i in range(2):
model += (X[i,:] - M * F) <= 0.0
#OBJECTIVE
model.objective = X.sum()
s = CyClpSimplex(model)
s.writeLp("myLpModel") # I write the LP, to check equations are formed correctly.
cbcModel = s.getCbcModel()
cbcModel.solve()
Question 1) I check the LP model, and see all of the equations are formed correctly. However, I cannot see equations corresponding to 'model += X >= 0.0'. I expect 460 line of constraints telling Xij >= 0. I had seen this with another CyLP example in the this Github page where a 's += y >= 0' constraint does not appear in the LP file. Is it a bug, or I am not defining correctly the constraint?
Question 2) The solver is currently reporting 'problem proven infeasible' or 'relaxation infeasible', depending on including or excluding the binary variable F. I am in a debugging phase. In either of these 2 situations, the solver still produces some values for problem variables. Clearly, values do not respect the constraints: X has some negative values; that's why I ask you my Question 1 about 460 missing positivity constraints. And F, which is supposed to be binary, gets decimal values. Is this a normal behavior of the solver when it cannot find a feasible response? I was expecting variable values respect the constraints, even if solver cannot find a response.
If you have gone through these interrogations, and know the answer, please advise,
Thank you in advance,
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Hello,
I try to solve a problem with binary variable, F, and continuous variable, X.
The purpose of using variable F is to limit number of Xij from X to 40.
model = CyLPModel()
PARAMETERS/VARIABLES
M=1000000 # M is a very big number
X = model.addVariable('X', (2, 230))
F = model.addVariable('F', 230, isInt=True)
CONSTRAINS
model += 0 <= F <= 1 # I use this together with isInt=True parameter earlier to define F as a binary var.
model += X >= 0.0
model += A * X >= B #A and B, are matrices with known values
model += F.sum() <= 40
for i in range(2):
model += (X[i,:] - M * F) <= 0.0
#OBJECTIVE
model.objective = X.sum()
s = CyClpSimplex(model)
s.writeLp("myLpModel") # I write the LP, to check equations are formed correctly.
cbcModel = s.getCbcModel()
cbcModel.solve()
Question 1) I check the LP model, and see all of the equations are formed correctly. However, I cannot see equations corresponding to 'model += X >= 0.0'. I expect 460 line of constraints telling Xij >= 0. I had seen this with another CyLP example in the this Github page where a 's += y >= 0' constraint does not appear in the LP file. Is it a bug, or I am not defining correctly the constraint?
Question 2) The solver is currently reporting 'problem proven infeasible' or 'relaxation infeasible', depending on including or excluding the binary variable F. I am in a debugging phase. In either of these 2 situations, the solver still produces some values for problem variables. Clearly, values do not respect the constraints: X has some negative values; that's why I ask you my Question 1 about 460 missing positivity constraints. And F, which is supposed to be binary, gets decimal values. Is this a normal behavior of the solver when it cannot find a feasible response? I was expecting variable values respect the constraints, even if solver cannot find a response.
If you have gone through these interrogations, and know the answer, please advise,
Thank you in advance,
All reactions