Forum Discussion

FICO's avatar
FICO
Community Manager
1 year ago

Is it possible to output wether or not Branch and Bound was used during optimization?

On my current MIP model I'm checking the value of the ALGORITHM attribute to see which algorithm is used. This works fine for smaller parameters, but via setparam("XPRS_verbose", true) I noticed that if the problem gets big enough Branch and Bound is being used as well to solve the problem. So I am looking for a command for having the use of B&B mentioned in my output section.

4 Replies

  • FICO's avatar
    FICO
    Community Manager

    I'm not sure I understand your question correctly. What kind of problems are you trying to solve?

    If the problem is a MIP or an MINLP (or a nonconvex NLP), then branch and bound will be used to solve it, regardless of problem size. For a linear or convex quadratic problem the algorithm is never B&B.

    Is it possible that you generate a nonconvex quadratic problem for larger parameters?

  • FICO's avatar
    FICO
    Community Manager

    Not sure this helps: you could check attributes like NODES and/or SLPMIPNODES. That would tell how many nodes where used to solve the problem. If 1 node was used the problem was solved at the root (and there was no branching and thus strictly speaking no branch-and-bound). If you have more than 1 node than the solver performed some kind of branching.

    This is a bit vague, though. Technically, processing the root is also part of branch-and-bound.

  • FICO's avatar
    FICO
    Community Manager

    Ah, thanks for the quick response and the explanation. I guess NODES should work, but since B&B is technically already being used at the root, then its not necessary for me to mention it. So am I right reading the following verbose output as, that this optimization stopped in the root after root cutting&heuristics, or did it even stop before, since "number of nodes" is 0?

    Starting root cutting & heuristics
    Deterministic mode with up to 2 additional threads
     
     Its Type    BestSoln    BestBound   Sols    Add    Del     Gap     GInf   Time
    P            1.000000     1.000000      1                  0.00%       0     23
    STOPPING - MIPRELSTOP target reached (MIPRELSTOP=0.0001  gap=0).
     *** Search completed ***
    Uncrunching matrix
    Final MIP objective                   : 1.000000000000000e+00
    Final MIP bound                       : 1.000000000000000e+00
      Solution time / primaldual integral :     23.54s/ 99.541160%
      Work / work units per second        :     22.97 /      0.98
      Number of solutions found / nodes   :         1 /         0
      Max primal violation      (abs/rel) :       0.0 /       0.0
      Max integer violation     (abs    ) :       0.0
  • FICO's avatar
    FICO
    Community Manager

    This stopped just after the root node, so no branching was performed, but I would argue that solving the root node is already part of branch and bound.