Skip to content
Advertisement

Benders.Strategy using Java and opl

I’m solving a mathematical model using Java however when i tried to call the Benders Strategy i keep receiving this error:

Exception in thread “main” java.lang.IllegalArgumentException: No enum class ilog.cplex.cppimpl.IloCplex$IntParam with value 1501

at ilog.cplex.cppimpl.IloCplex$IntParam.swigToEnum(IloCplex.java:1974) at ilog.opl.IloCplex.setParam(IloCplex.java:5640)

Here’s a part of my code in Java (i’m using CPLEX 12.8 and the library oplall.jar) :

import ilog.concert.IloException;
import ilog.concert.IloIntMap;
import ilog.concert.IloIntSet;
import ilog.concert.IloSymbolSet;
import ilog.opl.IloCplex;
import ilog.opl.IloOplDataSource;
import ilog.opl.IloOplErrorHandler;
import ilog.opl.IloOplFactory;
import ilog.opl.IloOplModel;
import ilog.opl.IloOplModelDefinition;
import ilog.opl.IloOplModelSource;
import ilog.opl.IloOplSettings;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.PrintWriter;

...

            IloOplFactory.setDebugMode(false);
            IloOplFactory oplF = new IloOplFactory();
            IloOplModelSource source = oplF.createOplModelSource("Model.mod");
            IloOplDataSource dataSource = oplF.createOplDataSource("Instance.dat");
            IloOplErrorHandler handler = oplF.createOplErrorHandler();
            IloOplSettings settings = oplF.createOplSettings(handler);
            IloOplModelDefinition def = oplF.createOplModelDefinition(source, settings);
            IloCplex cplex = new IloCplex();
            IloOplModel opl = oplF.createOplModel(def, cplex);
            opl.addDataSource(dataSource);

            cplex.setParam(IloCplex.IntParam.Benders.Strategy, 3);

            opl.generate();
            cplex.solve();
            cplex.end();

Advertisement

Answer

There’s a similar question here.

In model.mod you could write:

execute { cplex.bendersstrategy=3; }
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement