Originally posted by: windyyy
Hi All,
I am using OPL Java API for solving cutting stock problem using column generation, similar as the example of "C:\Program Files\IBM\ILOG\CPLEX_Studio1262\cplex\examples\src\java\CutStock.java". The data set is read from an excel file. The outline of the program is as follows:
IloCplex MasterPro=new IloCplex();
IloObjective CostCoeffi=MasterPro.addMinimize();
IloRange[] Constraints=new IloRange[NumberXXX];
IloNumVarArray VariablePool = new IloNumVarArray();
After initialization the master problem by adding some columns, a subproblem is solved to generate new columns and then be added into the 'VariablePool', until no better columns can be found:
VariablePool.add(MasterPro.numVar(NewColumn,0.0,Double.MAX_VALUE));
static class IloNumVarArray {
int _num = 0;
IloNumVar[] _array = new IloNumVar[24];
void add(IloNumVar ivar) {
if ( _num >= _array.length ) {
IloNumVar[] array = new IloNumVar[2 * _array.length];
System.arraycopy(_array, 0, array, 0, _num);
_array = array;
}
_array[_num++] = ivar;
}
IloNumVar getElement(int i) { return _array[i]; }
int getSize() { return _num; }
}
When the problem scale is small, the whole program runs well. However, internal problems as follows show up when the problem size becomes larger:
Exception in thread "main" java.lang.RuntimeException: internal error (Please notify IBM)
at ilog.concert.cppimpl.concert_wrapJNI.new_IloNumVar__SWIG_8(Native Method)
at ilog.concert.cppimpl.IloNumVar.<init>(IloNumVar.java:81)
at ilog.cplex.IloCplex.numVar(IloCplex.java:491)
at ilog.cplex.IloCplex.numVar(IloCplex.java:511)
at ilog.cplex.IloCplex.numVar(IloCplex.java:519)
at HelenCplexbefore.RenshuMiniInitial.ColumnGeneration(RenshuMiniInitial.java:1870)
at HelenCplexbefore.RenshuMiniInitial.main(RenshuMiniInitial.java:4663)
The 'RenshuMiniInitial.java:1870' corresponds to the line of adding new columns of 'VariablePool.add(MasterPro.numVar(NewColumn,0.0,Double.MAX_VALUE));' And also I have the knowledge that the problem may occur during adding new columns from 'at ilog.concert.cppimpl.concert_wrapJNI.new_IloNumVar__SWIG_8(Native Method)'. But I can't find any related information about the ".new_IloNumVar__SWIG_8".
Another thing needs to be pointed out is that this situation does not occur for every try. For example, the first run failed as above, however, when I tried again without making any modification, then the program can run well. Also, this internal error does not occur at the same place each time it happens.
Does anybody have an idea about this problem?Thanks for your help!
Cplex version: IBM ILOG CPLEX Optimization Studio 12.6.2.0
JDK: jdk1.8.0_91
BR,
Windy
#DecisionOptimization#OPLusingCPLEXOptimizer