Originally posted by: MamdouhMubarak
Hi
I am trying to test benders decomposition as implemented by cplex 12.8
I wrote the following java code to generate and annotate the variables:
1 IloCplex.LongAnnotation benders = CPLEX.newLongAnnotation("cpxBendersPartition");
2 X = CPLEX.boolVarArray(Network.Links.size());
3 Y = CPLEX.numVarArray(Network.Links.size(), 0, Float.MAX_VALUE, IloNumVarType.Int);
4 for (Link Link : Network.Links.values()) {
5 if (Link.Candidate) {
6 X[Link.Index].setName(String.format("X[%s]", Link.ID));
7 CPLEX.setAnnotation(benders, X[Link.Index], 0);
8 Y[Link.Index].setName(String.format("Y[%s]", Link.ID));
9 CPLEX.setAnnotation(benders, Y[Link.Index], 1);
10 }
11 }
but my code is crashing at line (6) and I am getting the following error:
Jan 18, 2018 12:55:40 AM MIP.MIP_minC_iloBD_ANNOTATED CreateVariables
SEVERE: null
ilog.cplex.IloCplex$UnknownObjectException: CPLEX Error: object is unknown to IloCplex
at ilog.cplex.IloCplex.getIndexOrException(IloCplex.java:11257)
at ilog.cplex.IloCplex.access$7400(IloCplex.java:297)
at ilog.cplex.IloCplex$AnnotationList.getIndexAndType(IloCplex.java:22525)
at ilog.cplex.IloCplex$AnnotationList.setAnnotation(IloCplex.java:22553)
at ilog.cplex.IloCplex.setAnnotation(IloCplex.java:23109)
would appreciate any help with this.
#CPLEXOptimizers#DecisionOptimization