Decision Optimization

Decision Optimization

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

 View Only
  • 1.  IloNumArray Data Declaration in C++ cplex

    Posted Sun October 26, 2014 12:28 PM

    Originally posted by: optimiz


    Hello everyone,

    I am trying to input the initial values of my IloNumArray type of data. In ILOG Cplex C++, how can I set the value of an "IloNumArray" to negative infinity?

    Thanks


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: IloNumArray Data Declaration in C++ cplex

    Posted Mon October 27, 2014 04:47 AM

    Have you tried using -IloInfinity or -std::numeric_limits<IloNum>::infinity() (the latter requires inclusion of <limits>)?


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: IloNumArray Data Declaration in C++ cplex

    Posted Mon October 27, 2014 10:11 PM

    Originally posted by: optimiz


    I actually tried IloInfinity but it doesn't seem to be working. The way I define it:

    IloNumArray data (env, 100);

    I tried:

    for(i=0; i < 100; i++)
    
    {
    
    data[i] = -IloInfinity;
    
    }
    

    It doesn't work. I am not sure about how to get the second form that you suggest. Could you give me an example of how you would set the values to -IloInifinity?

     

    Thanks


    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: IloNumArray Data Declaration in C++ cplex

    Posted Tue October 28, 2014 01:33 AM

    I would write the code exactly like you did. So what do you mean by "it does not work"? Does it

    • not compile
    • crash at runtime
    • show strange behavior at runtime (what happens, what do you expected instead)?

    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: IloNumArray Data Declaration in C++ cplex

    Posted Tue October 28, 2014 10:24 AM

    Originally posted by: optimiz


    So, when I run the code, I get the following error:

    Error  1650: Number not representable in exponential notation


    #CPLEXOptimizers
    #DecisionOptimization


  • 6.  Re: IloNumArray Data Declaration in C++ cplex

    Posted Wed October 29, 2014 02:25 AM

    What is the function that throws this exception?

    It looks like you are using infinity in a place where this is not allowed. What exactly are you using this value for, i.e., what are you doing with this IloNumArray that contains infinite values?


    #CPLEXOptimizers
    #DecisionOptimization


  • 7.  Re: IloNumArray Data Declaration in C++ cplex

    Posted Wed October 29, 2014 09:36 PM

    Originally posted by: optimiz


    So, data is used as a left hand side coefficient in the model. For example, 

    model.add(data[i]*x[i] + data2[i]*y[i] >=0.2)kind of constraints (assuming this is in a for loop, and data2 is IloNumArray with real numbers and y is IloNumVarArray)


    #CPLEXOptimizers
    #DecisionOptimization


  • 8.  Re: IloNumArray Data Declaration in C++ cplex

    Posted Mon November 10, 2014 03:22 AM

    Using infinity as coefficient in a linear expression that is used in a constraint is not supported. And it makes no sense, I think. What is a term like 'infinity * y[i]' supposed to mean in a linear constraint?


    #CPLEXOptimizers
    #DecisionOptimization