Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Change variable type using variable name

    Posted 10/11/11 02:17 PM

    Originally posted by: guvencdegirmenci


    Hi,

    I need to change the type of some variables from continuous to binary in my model. I know status = CPXchgctype (env, lp, cnt, indices, ctype); can be used for this but my model is quite big and I don't want to query indices and cnt of the variables etc. Is there a way to change type using variable names like (x1, x2)?
    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Change variable type using variable name

    Posted 10/11/11 09:00 PM

    Originally posted by: SystemAdmin


    Assuming that you are using the callable library, I donot see a way around using the CPXchgctype() method for changing the variable types. If you have to change the types based only on the variable names, you could use the CPXgetcolname method (
    status = CPXgetcolname (env, lp, cur_colname, cur_colnamestore,
                             cur_storespace, &surplus, 0,
                             cur_numcols-1);
    
    ), then create a indices array for the variables that you would like to change from continuous to binary, create a corresponding ctype array of 'B's and call the CPXchgctype() function.
    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Change variable type using variable name

    Posted 10/16/11 07:51 PM

    Originally posted by: guvencdegirmenci


    Thanks for the response.
    #CPLEXOptimizers
    #DecisionOptimization