Decision Optimization

Decision Optimization

Delivers prescriptive analytics capabilities and decision intelligence to improve decision-making.


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  cplex.setAnnotation

    Posted 01/18/18 01:58 AM

    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


  • 2.  Re: cplex.setAnnotation

    Posted 01/18/18 04:21 AM

    The problem is that your variables do not appear in any constraint or objective function yet. Hence CPLEX does not know anything about them and raises that exception. You can either move setting the annotations to a place in which the variables have already been added to constraints/objective, or you can explicitly IloCplex.add() the variables to avoid the exception.


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: cplex.setAnnotation

    Posted 01/18/18 04:47 AM

    Originally posted by: MamdouhMubarak


    Thanks Daniel! 


    #CPLEXOptimizers
    #DecisionOptimization