0
votes

I am trying to solve a model in java using Cplex. And I have to use column based modelling for that. My problem is similar to the following problem:

minimize 500x1 - x2
subject to   5x1 <= 10
             5x1 - 3x2 <=10

I know that I have to create a new column for every decision variable. But for adding the second constraint, do I need to create a new column for x1 or can I use the same column that I have used for the first constraint?

1
I think that if you create a new column, that is the equivalent of creating a new variable. So if you create another column for x1, then you will have two separate 'x1' variables in your model, and it won't do what you expected. I think you should re-use the first column. - TimChippingtonDerrick
Thanks a lot Tim. That was really helpful. If you don't mind can I ask you another question? I have a constraint in my model that uses double summation. But I couldn't find any suitable example for this. Do you happen to notice something like that? I really appreciate you helping me out here. - Dipta

1 Answers

0
votes

It should just work if you do the obvious thing. A useful trick is to get CPLEX to write its internal model out as an LP file which is relatively easy to read, and you can then check that the model is what you intended. I still find it far easier to write my models in a more algebraic style, which is similar to what you will get in the saved model LP file. Creating a model by explicitly changing the coefficients in the matrix is much more complex as it requires more care with indexing etc.