Decision Optimization

 View Only
  • 1.  branching on constraint and limitation on offspring nodes

    Posted Wed September 23, 2020 08:45 PM
    Hello all,

    I have used python API for coding an MIP, and I am trying to branch on certain constraints using .make_branch.
    However,  if I create more than two subproblems in each node, I will receive an error. Is there any limitation on the number of offspring nodes that can be created in each node?

    Thanks,

    ------------------------------
    Amin
    ------------------------------

    #DecisionOptimization


  • 2.  RE: branching on constraint and limitation on offspring nodes

    Community Leadership
    Posted Thu September 24, 2020 06:33 AM
    Yes, this function can be used to create at most two nodes.  But you can work around this limitation by creating, at each step, a 'real' node, and a 'fake' one.  In the fake node, you will create a second 'real' node, and yet another fake node, etc.  This will let you create as many 'real' nodes as you want, as long as you actually organise them in a binary tree.

    ------------------------------
    Xavier
    ------------------------------



  • 3.  RE: branching on constraint and limitation on offspring nodes

    Posted Sat September 26, 2020 04:06 PM
    Thanks for the reply!

    I am wondering how I can recognize the fake node later on in my code? Possibly I should create a dummy variable for this purpose?

    ------------------------------
    Amin
    ------------------------------



  • 4.  RE: branching on constraint and limitation on offspring nodes

    IBM Champion
    Posted Thu September 24, 2020 05:17 PM
    In support of Xavier's answer, I actually did a series of three blog posts (the first one ten years ago), including sample code (using the Java API):


    ------------------------------
    Paul Rubin
    Professor Emeritus
    Michigan State University
    ------------------------------



  • 5.  RE: branching on constraint and limitation on offspring nodes

    Posted Sat September 26, 2020 08:16 PM
    Thanks Paul for the reply!
    Unfortunately, I am not familiar with Java, so I could not figure out your code. Please look at my above question in reply to Xavier as well! Another challenge that I am probably facing is that this is like one-time branching that I wish it to occur only in the root node. The root node has an index of zero, so it is easy to recognize, but I guess the indexing of the other nodes in the tree happens more in a random fashion, so I cannot recognize at what level of the B&B tree I am now.

    ------------------------------
    Amin
    ------------------------------



  • 6.  RE: branching on constraint and limitation on offspring nodes

    IBM Champion
    Posted Sun September 27, 2020 02:34 PM
    I'm not familiar with the Python API, but I assume it has the following in common with the Java API. CPLEX assigns a unique ID to every node, with the ID of the root node being zero. The various methods for creating branches in a callback all return the ID number of the child node being created, and there are methods to get the ID of the current node. So you just create a memory structure in your callback that associates ID numbers with information about the node (what constraints you used to create the node, or what your next step at that node should be, or whatever). You only need to insert entries there for nodes that need follow-up work (such as the dummy children). If your callback encounters a node whose ID is not in the table, it assumes this node is further down the tree and just lets CPLEX branch as it wishes there.

    ------------------------------
    Paul Rubin
    Professor Emeritus
    Michigan State University
    ------------------------------



  • 7.  RE: branching on constraint and limitation on offspring nodes

    Posted Sun September 27, 2020 05:16 PM
    Thanks Paul!
    I did not know that we could get the ID of the created child node.

    ------------------------------
    Amin
    ------------------------------