IBM ILOG CPLEX: CPLEX Error 1217: No solution exists. workflow.mod /.../workflow.mod OPL-Problemmarkierung
Hi Everyone,
I am looking for help on solving the fixed version of an MIP porblem.
A little of context:
I am using ILOG scripting lenguage to coordinate the Data and model declaration, with the corresponding postprocessing.
I am currently using : IBM ILOG CPLEX Optimization Studio Version: 12.8.0.0
So far I understand that, in order to do so I will need to solve the MIP version and afterwards call the solveFixed routine.
my problem migth just berelated to a wrong usage of the IloOplMdel Instances.
I have following files which are included or explecitly calle in the main script.
------------------
1. varDecl.mod : This file only include variable declaration of the form:
type name = ...;
{type} name = ...;
type name[name_i] = ...;
------------------
2. Data.dat : Here the data is written in the espected format for cplex
name_i = mydataofName_i
------------------
3. MIPproblemDecl.mod : This file define the decision variables, the objective and the constraints. it first calls the varDecl.mod file through including it.
include "varDecl.mod";
dvar type name;
.
.
.
minimize
subject to {ct1:.... ct2:...}
------------------
Now to the real problem where I am currently stock.
my workflow filelooks like this:
4. workflow.mod : here is written my script and where I believe all the problems are rigth now.
include "varDecl.mod"; // it starts by includig the varaible name files.
main
{ // start of script:main
// Prepare OPL Model
thisOplModel.generate(); // I see this appearing in some examples and some others not, i dont understandhow this global opl model works. But I noticed that inside this object there is the data from Data.dat, even when I never explicitely gave it to him (I supposue it goes like that because it is in the same directory
var source = new IloOplModelSource("MIPproblemDecl.mod"); // read my model from the file
var cplex = new IloCplex();
var def = new IloOplModelDefinition(source);
var data = thisOplModel.dataElements; // get the data out of the "thisOplModel" whichwas taken from "Data.dat"
// Do some data Preprocessing
// dataPre = function applied on data
// data[i] <- dataPre[i]
// Write pre processing to the console
// Create OPL Model
var opl_MIP = new IloOplModel(def, cplex);
opl_MIP.addDataSource(data)
opl_MIP.generate();
// solve problem in MIP version
if (cplex.solve())
{
cplex.exportModel("MIP.lp")
writeln("MIP Objective = " + cplex.getObjValue());
writeln(current.printSolution())
} else
{
writeln("No solution");
break
}
// solve problem in Fixed version
if (cplex.solveFixed())
{
cplex.exportModel("FIX.lp")
writeln("FIX Objective = " + cplex.getObjValue());
writeln(current.printSolution()) // -----HERE--- is where the error occurs
// Here I would like as well to acces the Dual variables, Reduced Costs, etc.
} else
{
writeln("No solution");
break
}
} // finisch of sript:main
------------------
Questions:
1- As you can see from the introduction PLEX returns the Error 1217 were no Solution can be accesed. This problem should appear in particular if somechange to the model has been made between solutions, but this time that is not the case.
2- I suppose my main question is, how to write and use the oplModel instances (opl_MIP, and thisOplModel) such that i can solve the fixed MIP problem
3- Why in some examples a second model (eg. opl2) is used when the data or some parameter is changed, and if in this case it should be aplied aswell.
4- Why does the (thisOplModel) exist, and what should be its use, it confuses me that the routine IloOplModel.generate() is called two times, I dont know if some values are being mixed.
5- The two ".lp" files show exactly the same problem. this let me to the conclusion that even when cplex.solveFixed returned True, (because it enters in the if clausel) the problem was not changed and the binary variables still exists. is that correct or I am wrong in my conclusion?
6- Are these Problems that only occur on this version of CPLEX und Studio?
7- Í also realized some examples use something like : var name = thisOplModel, why is that done in some cases and some others not?
8- Finally I thougth one possibility would be to implement the solveFixed by my self, by invoking opl.convertAllIntVars(), but by doing so the Integer values are not saved, and if there is no solution by using solveFixed(), how could I go to fix these values without ading anothe equality constraint.
thank you very much in advance,
I am expecting your answers.
------------------------------
Cesar Garcia
------------------------------
#DecisionOptimization