Decision Optimization

Decision Optimization

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

 View Only
Expand all | Collapse all

How to prune a node in the search tree?

  • 1.  How to prune a node in the search tree?

    Posted Tue May 13, 2014 10:30 PM

    Originally posted by: mremn


    Hi everybody,

     

    While searching in the constraint programming, I need to prune a node if it does not satisfy some conditions. I'm not sure I should use a gold or "writing a constraint". In the latter case, I can use modifiers to tell the solver that the current solution is infeasible  (e.g. x.setValue(-1)  for a non-negative variable x). But I'm not sure this makes x equal to -1 for other nodes. 

     

    Thank you for your help,

     

    Ha Minh Hoang


    #ConstraintProgramming-General
    #DecisionOptimization


  • 2.  Re: How to prune a node in the search tree?

    Posted Mon May 19, 2014 08:47 AM

    Originally posted by: GGR


    Hi

     

    You actually seem needing a custom constraint. Beware a constraint does is not a global cut. It is local to the node you apply the pruning. If a constraint hold on a variable x domain, the pruning algorithm (the propagate member of an instance of IlcConstraintI) is executed to reduve the actual domain of the involved constraint. The domain reduction is undid when the solver backtrack through the node.

     

    Hope that helps


    #ConstraintProgramming-General
    #DecisionOptimization


  • 3.  Re: How to prune a node in the search tree?

    Posted Tue May 20, 2014 04:47 PM

    Originally posted by: mremn


    Thank you GGR for your answer,

    So I really need a custom constraint to prune a node. However, I need to know the objective value of the current best integer solution so far. How could I retrieve this information while writing a constraint?

     

     

     

     

     

     

     


    #ConstraintProgramming-General
    #DecisionOptimization


  • 4.  Re: How to prune a node in the search tree?

    Posted Wed May 21, 2014 08:14 AM

    Originally posted by: GGR


    Hi

     

    You should have a look to the function IloCP::next(). After each succcessful iteration, the solver is in a state that is the best so far incumbent.


    IloEnv env();
    IloModel model(env);
    /*..*/ //fill the model
    IloExpr obj = /*..*/; the objective expression
    IloGoal goal = /*..*/; // if you do not use automatic search
    IloConstraint ct = /*..*/; the user constraint
    IloMinimize(model, obj);
    IloCP cp(model);
    cp.startNewSearch(goal); //
    ignore goal argument in automatic search
    while(cp.next()) {
        IloNum bestSoFar = cp.getObjValue();
        /*..*/ store bestSofar in your data structure
    }

    Hope that helps


    #ConstraintProgramming-General
    #DecisionOptimization