How can I put a limitation for CPLEX parameters?

167 Views Asked by At

I asked my question before. However, because I did not put my code I never get my answer. I'm new in CPLEX and I need help. my code tries to solve a p median problem. I created an OPL project which contains one mod and one data file. The code is :

//
execute{
var before = new Date();
temp = before.getTime();
}

execute {

  var f = new IloOplInputFile("1.csv");
 ...
    }
  }
  writeln(index);
  writeln(weight);
}
 float d[...][...];
execute {
var f = new IloOplInputFile("2.csv");
...     
    }
  writeln(d);
}
}

 dvar boolean x[...][...];
 dvar boolean y[...];   
// Objective Function
dvar float obj;
minimize obj;
//Constraints
 subject to {
...
 } 

 //Get the runtime in ms
 float soltime;
  execute{
var after = new Date();
soltime = after.getTime()-temp;
}
...
//Output in a CSV file
execute{
...
var f=new IloOplOutputFile("3.csv");
f.writeln(...);
f.close();
}

This is not a complete code. I just want to show what my code contains some execute block and minimizing objective function and its constraints. Because I work with large dataset solving this problem takes so much time. I wanted to limit this solving time to 1 hour and also try to change the gap between the lower and upper bound. But when I tried to use :

execute PARAMS{
CPLEX.tilim=...
CPLEX.egap=...
} 

in the following of my code, nothing happened. I know I got some answers like I need to do it in flow control or scripts or... but I want to know with more details that what should I exactly do. Do I need to mod files? Should I add some file? Please help me.

0

There are 0 best solutions below