Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Depth first search and get depth.

    Posted 08/19/10 07:59 AM

    Originally posted by: cplexQuestions


    Hello All;

    I am quite new to Cplex and to programming. I am using C++ and I want to set the solver to use a depth first search branching strategy and, after the solution is completed, output the maximum depth and perhaps the number of nodes explored (if this is possible). If someone could help me out would be great. Thanks!
    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Depth first search and get depth.

    Posted 08/19/10 08:31 AM

    Originally posted by: SystemAdmin


    In order to force depth-first search set parameter CPX_PARAM_NODESEL (which is IloCplex::NodeSel in C++) to value 0 (CPX_NODESEL_DFS in C, IloCplex::DFS).

    After IloCplex::solve() returned you can query the number of nodes explored using IloCplex::getNnodes().

    In order to keep track of the maximum depth you will have to use a callback.
    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Depth first search and get depth.

    Posted 08/19/10 08:31 AM

    Originally posted by: SystemAdmin


    Unfortunately, we do not track the maximal depth of the tree, so this is not so easy to get.

    What you can do is to install a callback, for example a MIP callback by means of CPXsetmipcallbackfunc(). (I am talking about the C interface, as I don't know the C++ interface well enough, but you are probably able to translate this to the C++ interface.)
    This callback is called at each node, and you can query the depth of the current node by CPXgetcallbacknodeinfo() using the whichinfo = CPX_CALLBACK_INFO_NODE_DEPTH argument. Then, just calculate the max depth yourself.

    To get depth first search, just set the CPX_PARAM_NODESEL parameter (NodeSel in Concert) to CPX_NODESEL_DFS.
    Tobias
    #CPLEXOptimizers
    #DecisionOptimization