Decision Optimization

Decision Optimization

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

 View Only
  • 1.  Using unrestricted variables

    Posted Tue July 10, 2012 11:50 PM

    Originally posted by: FANS_Nader_Al_Theeb


    Hello

    I have an unrestricted variables with bounds (-400,400) defined as following

    
    IloNumVarArray3 dev_aot(env,nbComm);   
    
    for( a = 0; a < nbComm; a++) 
    { dev_aot[a] = IloNumVarArray2 (env, nbDNodes); 
    
    for( o=0; o<nbDNodes; o++) 
    { dev_aot[a][o] = IloNumVarArray (env, nbTimes,  -400, 400);    
    }    
    }
    


    And I have constraint as in the following

    
    model.add(dev_aot[a][o][t] == daot[a][o][t] - ZD - dev_aot[a][o][t-1]);
    


    but I need to use the
    
    dev_aot[a][o][t-1]
    

    only if it is negative

    In CPLEX, we can't use if statement with variable conditions like the following

    
    
    
    if (dev_aot[a][o][t-1] <=0 ) 
    {model.add(dev_aot[a][o][t] == daot[a][o][t] - ZD - dev_aot[a][o][t-1]);
    }   
    
    if (dev_aot[a][o][t-1] >=0 ) 
    {model.add(dev_aot[a][o][t] == daot[a][o][t] - ZD );
    }
    


    So, is there any other method to use the variable only when its value is negative

    Thanks
    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Using unrestricted variables

    Posted Wed July 11, 2012 03:55 AM

    Originally posted by: SystemAdmin


    Did you try the IloCplex::ifThen() method?
    That should allow you to implement the two 'if' conditions you listed.
    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Using unrestricted variables

    Posted Wed July 11, 2012 12:26 PM

    Originally posted by: FANS_Nader_Al_Theeb


    Thank you Daniel

    Can you show me a simple example, because I received an error

    ‘ifThen’ is not a member of ‘IloCplex’

    May be I write the command incorrectly

    Thanks a lot
    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: Using unrestricted variables

    Posted Wed July 11, 2012 12:40 PM

    Originally posted by: SystemAdmin


    Sorry, ifThen() is for Java Concert. In C++ Concert use class IloIfThen.
    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: Using unrestricted variables

    Posted Wed July 11, 2012 12:27 PM

    Originally posted by: FANS_Nader_Al_Theeb


    I forget to mention that I'm using CPLEX - concert technology

    Thanks
    #CPLEXOptimizers
    #DecisionOptimization