Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
Expand all | Collapse all

Problem using Callback...???

  • 1.  Problem using Callback...???

    Posted 09/05/13 01:58 PM

    Originally posted by: karlomc


    Hi all,


         I'm working on a cutting plane algorithm with callback, then run a relaxed problem (few restrictions) and iteratively solve a problem, in each iteration added a new set of cuts and verify if the solution is only one route, if so ends the algorithm .
     

    cplex.use(CtCallback(env, model, cplex, x, y, lhs, rhs, cplex.getParam(IloCplex::EpRHS)));

     

    ILOUSERCUTCALLBACK7(CtCallback, IloModel, model, IloCplex&, cplex, IloArray <IloArray <IloArray <IloBoolVar> > >, x,
                                    IloArray <IloArray <IloArray <IloIntVar > > >, y,
                                    IloExprArray, lhs, IloExprArray, rhs,
                                    IloNum, eps){


        IloExpr exprA (getEnv());
        IloExpr exprB (getEnv());

        exprA+= x[0][0][0];

        exprB+= y[0][0][0]+y[2][1][0];

        model(exprA<exprB);

    }

    Error: main.cpp:66: error: no match for call to '(IloModel) (IloConstraint)'... as I can make this process that at each iteration adding a set of constraints and that is also iterative?

    Greetings and thank you very much,
     

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Problem using Callback...???

    Posted 09/05/13 05:17 PM

    What is this statement

    model(exprA<exprB);

    supposed to do? Obviously you are using the wrong syntax. Do you want to update the model you are currently optimizing? That is not allowed. Do you want to add the constraint "exprA<exprB" as a cut? Then use the callback's add() function (but notice that strict inequality will be turned into <= with a small epsilon on one side).

    Maybe you should check some of the examples that come with the CPLEX distribution and use (cut) callbacks.


    #CPLEXOptimizers
    #DecisionOptimization