Hello, everyone! I would like to solve with CPLEX a matrix equation of the form:
n1 = n0 + C*x.
n1 and n0 as well as C (three matrices) are given, x must be calculated (integer solution).
For example see the attached file. The last matrix with 1 column and 3 rows is not given and must be found.
I'm new to CPLEX, any help is very much appreciated!
Thanks in advance!
Topic

Re: Solve a matrix equation with ILP?
20121229T17:00:03ZThis is the accepted answer. This is the accepted answer.Hello,
You can do something like this:
Minimize Obj: c1 + c2 + c3 Subject To R1: 2c1 + c2 + c3 = 1 R2: c1  c2 = 0 R3: c1  c3 = 1 R4: 2c2 + 2c3 = 2 General c1 c2 c3 End
The solution to this is 0, 0, 1.
You could either use C callable library or C++/Java Concert or some other means that you are comfortable with, to load your matrix into CPLEX data structures. Once you do that, then you can use any of the CPLEX optimizers to solve the problem. In case of many solutions to your problem, the above would find the minimum of the sum. You could try other functions too.
Regards,
Vivek.Updated on 20140324T22:43:34Z at 20140324T22:43:34Z by ironman 
Re: Solve a matrix equation with ILP?
20121229T18:06:45ZThis is the accepted answer. This is the accepted answer. SystemAdmin
 20121229T17:00:03Z
Hello,
You can do something like this:
<pre class="java dw" dataeditorlang="java" datapbcklang="java" dir="ltr">Minimize Obj: c1 + c2 + c3 Subject To R1: 2c1 + c2 + c3 = 1 R2: c1  c2 = 0 R3: c1  c3 = 1 R4: 2c2 + 2c3 = 2 General c1 c2 c3 End </pre>
The solution to this is 0, 0, 1.
You could either use C callable library or C++/Java Concert or some other means that you are comfortable with, to load your matrix into CPLEX data structures. Once you do that, then you can use any of the CPLEX optimizers to solve the problem. In case of many solutions to your problem, the above would find the minimum of the sum. You could try other functions too.
Regards,
Vivek.
thank you very much! I was looking for it, it is great!
I have two questions:
1) What function can I use to store/enumerate all possible solutions (if there are more then 1 solution).
2) I am going to use Java to load the matrix into CPLEX and then get the results back into the program. I am familiar with Java, however I am new to CPLEX. Could you give me some code examples, how to load data (the above matrix) into CPLEX and how to get the results back?
Your help is greatly appreciated!
Thank you! 
Re: Solve a matrix equation with ILP?
20121229T19:01:15ZThis is the accepted answer. This is the accepted answer. SystemAdmin
 20121229T18:06:45Z
Hello VivekPeriaraj,
thank you very much! I was looking for it, it is great!
I have two questions:
1) What function can I use to store/enumerate all possible solutions (if there are more then 1 solution).
2) I am going to use Java to load the matrix into CPLEX and then get the results back into the program. I am familiar with Java, however I am new to CPLEX. Could you give me some code examples, how to load data (the above matrix) into CPLEX and how to get the results back?
Your help is greatly appreciated!
Thank you!
1) You could use the 'solution pool' feature of CPLEX to do that. You can find more abt it here:
http://pic.dhe.ibm.com/infocenter/cosinfoc/v12r3/index.jsp?topic=%2Filog.odms.cplex.help%2FContent%2FOptimization%2FDocumentation%2FOptimization_Studio%2F_pubskel%2Fps_usrmancplex1900.html
2) You can find many examples in the CPLEX install directory. In my install, I find it here > cplex/examples/src/java
Regards,
Vivek. 
Re: Solve a matrix equation with ILP?
20121229T21:11:02ZThis is the accepted answer. This is the accepted answer. SystemAdmin
 20121229T19:01:15Z
Hi Mark,
1) You could use the 'solution pool' feature of CPLEX to do that. You can find more abt it here:
http://pic.dhe.ibm.com/infocenter/cosinfoc/v12r3/index.jsp?topic=%2Filog.odms.cplex.help%2FContent%2FOptimization%2FDocumentation%2FOptimization_Studio%2F_pubskel%2Fps_usrmancplex1900.html
2) You can find many examples in the CPLEX install directory. In my install, I find it here > cplex/examples/src/java
Regards,
Vivek.
I will try to use that feature. Then I will get familiar with the available examples in the CPLEX install directory and try to implement my program.
Thanks again.
Best regards. 
Re: Solve a matrix equation with ILP?
20121230T15:06:15ZThis is the accepted answer. This is the accepted answer. SystemAdmin
 20121229T21:11:02Z
Thank you VivekPeriaraj,
I will try to use that feature. Then I will get familiar with the available examples in the CPLEX install directory and try to implement my program.
Thanks again.
Best regards.
Good luck!
Vivek. 
Re: Solve a matrix equation with ILP?
20130102T07:24:38ZThis is the accepted answer. This is the accepted answer. SystemAdmin
 20121230T15:06:15Z
Hello, One point to note is that the enumerate from the solution pool would only populate feasible solutions that the optimizer find while it parses through the tree and not all of them like you want.
Good luck!
Vivek. 
Re: Solve a matrix equation with ILP?
20130102T16:15:17ZThis is the accepted answer. This is the accepted answer. SystemAdmin
 20130102T07:24:38Z
If you set the solution pool intensity while populating the pool then CPLEX should enumerate all feasible solutions.
Regards,
Vivek.