Decision Optimization

Decision Optimization

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

 View Only
Expand all | Collapse all

accessing only nonzero decision variables in the current node LP solution

  • 1.  accessing only nonzero decision variables in the current node LP solution

    Posted Tue February 16, 2010 07:58 PM

    Originally posted by: SystemAdmin


    Hi,
    In my cut callback for a MIP that I solve, I access the decision variables through CPXgetcallbacknodex. I then have to cycle through all the variables (even when presolve is turned on) to find which ones have nonzero values. I do not find a function in the callable library reference which enables one to grab only the columns that have nonzero value, so I was wondering if anyone knew of some trick or efficient way to grab only the non-zero variables. I work with n^2 decision variables and typically between only n and 3n of them are nonzero so there's quite a waste in continually cycling through to grab the nonzeros.

    Thanks for any recommendations.
    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: accessing only nonzero decision variables in the current node LP solution

    Posted Wed February 17, 2010 04:16 AM

    Originally posted by: SystemAdmin


    If you are using simplex for your LP relaxations, and if the number of variables is larger than the number of constraints, then it could be useful to query the LP basis with a call to CPXgetbhead(). This will give you the array of basic variables, which is of size 'rows'. Each non-negative entry in this array corresponds to a structural variable (in contrast to negative entries, which correspond to slack variables of rows). Of course, you still have to check the x value of these basic variables because it can be integral even if the variable is basic. But this allows you to skip over all non-basic variables for which you know the value is integral.
    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: accessing only nonzero decision variables in the current node LP solution

    Posted Wed February 17, 2010 09:17 AM

    Originally posted by: SystemAdmin


    Thank you - excellent recommendation and I will give it a try. Anything like this should be an improvement over my current method.
    #CPLEXOptimizers
    #DecisionOptimization