2
$\begingroup$

Does CPLEX OPL provides support for info callback? By info callback I am referring to callback allowing to retrieve information of the current solution at a given step of the optimization process.

$\endgroup$

1 Answer 1

2
$\begingroup$

I am not aware of if informational callbacks can be invoked directly via OPl-CPLEX the same as the low-level programming language. For more details, you can check What informational callbacks can return on the IBM host. As far as I know, to access some low-level information in OPL, you have two ways.

1- Using the Main block to call some functions like:

main {         
opl.postProcess();        
writeln("Current solution : ", cplex1.getObjValue()); 
} 

2- linking OPL with a low-level language like Java to call some functions:

IloOplModel opl = oplF.createOplModel(def, cplex);
opl.generate();
cplex.solve();
System.out.println("OBJECTIVE: " + opl.getCplex().getObjValue());
opl.postProcess();
opl.printSolution(System.out);

For the first way TSP by adding a lazy constraint and for the second distMIP example on the C:\Program Files\IBM\ILOG\CPLEX_Studio201\opl\examples\opl_interfaces\java might be helpful.

$\endgroup$
2
  • $\begingroup$ Thank you so much, this is really helpful! $\endgroup$ Commented Nov 26, 2023 at 0:36
  • 1
    $\begingroup$ @MatheusDiógenesAndrade, your welcome and I am glad it helps. $\endgroup$
    – A.Omidi
    Commented Nov 26, 2023 at 4:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.