Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
Expand all | Collapse all

Storing Optimal basis by Node number in B&B tree

  • 1.  Storing Optimal basis by Node number in B&B tree

    Posted 02/25/18 06:28 PM

    Originally posted by: A.Malik


    Hello All,

     

    I am using a branch-and-bound based algorithm for a non-linear problem with continuous variables only. At every iteration, I branch from a node with lowest lower bound to left and right node. Now, to solve the left and right node I would like to read the optimal basis of the parent node. I know using cplex.readbasis(), I can read the optimal basis and using cplex.writebasis() I can write optimal basis. However, in my case the algorithm jumps from node to node in no sequence. For example:- At root node 0 (branched to node 1 and 2), I realized I should branch from node 1 and kept on branching on node 1 branch, and never touched node 2. Now, after 10 iterations the algorithm tells me that I need to branch from node 2, now to solve the child nodes I need optimal basis of node 2, which I don't have because node 2 is history. So, is there a way to create a basis file for each node of this B&B tree. Something like: cplex.writebasis("Optimal_Basis_At_Node_%d.bas", current_node);. BTW I tried this and cplex says too many arguments.

     

    Thanks for your time in advance.


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Storing Optimal basis by Node number in B&B tree

    Posted 02/26/18 07:29 AM

    As you noticed, the writeBasis() function does not support dynamic construction of a file name. But why don't you just construct that filename in a separate buffer and then pass this buffer to writeBasis()?

    In C++ (untested code):

    std::stringstream s;
    s << "Optimal_Basis_At_Node" << current_node << ".bas";
    cplex.writeBasis(s.str().c_str());
    

    In Java (again untested):

    cplex.writeBasis(String.format("Optimal_Basis_At_Node_%d.bas", current_node));
    

    It may be more convenient and faster (especially if you solve a lot of nodes) to store the basis in memory rather than on disk. The getBasisStatuses() function returns the basis status for all variables and constraints. That should allow you to copy/restore a basis to/from memory.


    #CPLEXOptimizers
    #DecisionOptimization