Decision Optimization

 View Only
  • 1.  Accessing simplex tableau at any node in branch-and-cut tree

    Posted Wed December 01, 2021 09:01 AM
    I want to add various cuts at intermediate stages of the branch-and-cut tree using the UserCutCallback. To add, for example, Gomory cuts manually using the cut callback, I'd need to be able to access the simplex tableau obtained by solving the LP relaxation at any given node of the branch-and-cut search tree. I know there's a cpx.solution.advanced.binvarow() attribute to access rows of the optimal simplex tableau *after* the entire problem has been solved, but is this possible at any node using callbacks? As far as I can see, the UserCutCallback doesn't provide any way of doing this (though it is possible to access the value of the LP optimum using this callback). 

    Thanks in advance!

    ------------------------------
    Siddharth Prasad
    ------------------------------


  • 2.  RE: Accessing simplex tableau at any node in branch-and-cut tree

    Posted Mon December 06, 2021 09:36 AM
    Hello, it's not possible with the current callback api.

    ------------------------------
    Vincent Beraudier
    ------------------------------



  • 3.  RE: Accessing simplex tableau at any node in branch-and-cut tree

    Posted Mon December 06, 2021 10:06 AM
    Thanks for the response. I could be wrong, but isn't this possible in the C/C++ APIs? For example, I think https://www.ibm.com/docs/en/icos/20.1.0?topic=g-cpxxgetbase-cpxgetbase can be used within cut/branch callbacks in the C and C++ APIs, but I can't find anything equivalent in the Python API? So, is it the case that what I asked (accessing optimal basis) is possible in the C and C++ API and not in the Python API? I'm just wondering if there isn't a more nuanced answer to my question than just "No".

    ------------------------------
    Siddharth Prasad
    ------------------------------



  • 4.  RE: Accessing simplex tableau at any node in branch-and-cut tree

    Posted Mon December 06, 2021 11:45 AM
    You're right my answer was a bit strict: there is no API on the callbacks (legacy callbacks or generic callbacks) in any language which provide this piece of information (that is access the simplex tableau obtained by solving the LP relaxation at any given node of the branch-and-cut search tree).

    What you may try to do is to query the nodelp in callbacks (that is an approximation of the actual nodelp), then solve it with some method, then access the information the information required.
    It should be possible to do this with legacy callbacks or generic callbacks.

    Anything that is possible in C should be possible in python.

    For C++, it will not be the case: some api is not available in C++ and one has to query the LP pointer and switch to C to use the missing api.


    ------------------------------
    Vincent Beraudier
    ------------------------------



  • 5.  RE: Accessing simplex tableau at any node in branch-and-cut tree

    Posted Mon December 06, 2021 12:24 PM
    Thanks for the answer! I did some more searching based on the nodelp suggestion, and I found a q/a here (https://stackoverflow.com/questions/55907192/cplex-accessing-strong-branching-values-via-python-api) that indicates that accessing nodelp directly is not possible in the Python API (but you can do this in the C api and I have some code written by a collaborator that does this in the C++ api).

    Unfortunately, most of the suggested workarounds in the stackoverflow link do not seem relevant to my situation of wanting to manually add Gomory cuts. One possibility is the suggestion by rkersh to clone the original problem and pass it to the callback when creating it. My guess is that I'm probably better off just switching to C/C++.

    ------------------------------
    Siddharth Prasad
    ------------------------------