Originally posted by: JorisK
Dear,
I'm trying to implement a model using ILOG CP (12.5.1)+java interface. My model requires sequence dependent setup times. Whenever I define the following:
IloTransitionDistance td = cp.transitionDistance(costMatrix);
my java program crashes with the following exception:
ilog.concert.IloException: X& IloArray::operator[] (IloInt i) : Out of bounds operation: index superior to size of array
at ilog.concert.cppimpl.concert_wrapJNI.IloIntArray2_set_IloIntArray(Native Method)
at ilog.concert.cppimpl.IloIntArray2.set_IloIntArray(IloIntArray2.java:57)
at ilog.concert.cppimpl.IloConcertUtils.ToCppIloIntArray2(IloConcertUtils.java:471)
at ilog.cp.IloCP.transitionDistance(IloCP.java:8153)
at algorithms.exact.cp.ModelBuilder.buildrmcp(ModelBuilder.java:129)
at algorithms.exact.cp.ModelBuilder.<init>(ModelBuilder.java:26)
at algorithms.exact.cp.CP.<init>(CP.java:16)
at main.CPTest.<init>(CPTest.java:24)
at main.CPTest.main(CPTest.java:33)
Exception in thread "main" java.lang.NullPointerException
at algorithms.exact.cp.CP.solve(CP.java:22)
at main.CPTest.<init>(CPTest.java:26)
at main.CPTest.main(CPTest.java:33)
What could be the cause of this exception? My costMatrix is a 2 dimensional int array where costMatrix[i][j] provides the cost to travel from i to j. The costMatrix only contains non-negative entries.
This on the other hand does work:
IloTransitionDistance td =cp.transitionDistance(costMatrix.length);
for(int i=0; i<rmcp.nrOfVertices; i++){
for(int j=0; j<rmcp.nrOfVertices; j++){
td.setValue(i, j, costMatrix[i][j]);
}
}
#CPOptimizer#DecisionOptimization