I would like to solve several instances of the same problem in ILOG CPLEX by two different models. Can anyone please provide me with an script example on how to do it? Which is the best/simplest way to do this?
Hello, the simplest way is to write the models in the OPL Language of the CPLEX into two separate projects,if you give me more information of your problem I can help you with that. If you want a multiple run, you should use a script in OPL that calls a certain model and changes a parameter at each run. If this is your case I can provide some helpul information. I look forward to your reply.
My models are in multiple machine scheduling, I have a couple of formulations were I would like to test the impact of some valid inequalities. Therefore I would need to code each formulation-inequality combination in a different model, which isn't a problem for me. And then, create a script that will loop within my test instances and for each instance will sequentially test each formulation-inequality combination, and this is what is troublesome for me since I don't know which command to use in OPL to call models and change the instances from iteration to iteration of the loop.
Say my model names are AAA1 to AAA3 and BBB1 to BBB3 and my test instances are numbered from 1 to 100. Which would be a proper syntax for the script calling all the AAA and BBB models solving each one of the hundred instances?
You can write your model with a language programming such as Java or C# with Cplex . My mean is you can use interface between Java or C# with CPLEX and write your model in Java and call Cplex for solve model.
I believe I have the same problem. There are two different projects. I need to run the first one, and get value of a specific decision variable to use it into the 2nd opl model as an input, and run the 2nd model. However, I'm failed to equal these variables to each other.
Hi, one way to do it is using CPLEX OPL "Flow Control" i.e. putting a main{} after your first model. The general template will be something like:
// Parameters and Decision Variables declaration
minimize/maximize ...
subject to
{ ...
}
main{
// Load the data for both phases of your heuristic (model definition, cplex and data elements) with different names so that you could reuse them and even modify (the copies you are making) the parameters and data elements inside a for loop.
while (...)
{
// Solve your first model and use getValue/getDual/... to obtain information regarding the optimal values of the models
// Modify the information on the Data elements by making references to it: FirstModelData.CostVector = ... ;// for instance
}
}
I think this should do as I'm currently following one such scheme. If you want more ideas you could use the Cutting Stock example of CPLEX OPL projects where a Column Generation i.e. a two-phase method, is implemented.