我正在使用 Java 解决数学模型,但是当我尝试调用 Benders 策略时,我一直收到此错误:
线程“主”java.lang.IllegalArgumentException 中的异常:没有值为 1501 的枚举类 ilog.cplex.cppimpl.IloCplex$IntParam
在 ilog.cplex.cppimpl.IloCplex$IntParam.swigToEnum(IloCplex.java:1974) 在 ilog.opl.IloCplex.setParam(IloCplex.java:5640)
这是我的 Java 代码的一部分(我使用的是 CPLEX 12.8 和库 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();