Decision Optimization

Decision Optimization

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

 View Only
Expand all | Collapse all

tuple in tupleSet does not work anymore

  • 1.  tuple in tupleSet does not work anymore

    Posted Mon October 23, 2017 07:51 AM

    Originally posted by: ouaigooo


    Hi,

    Interestingly this code used to work with 12.6.3 but produces the following error with 12.7.1:

    ASSERT FAILED: X& IloArray::operator[] (IloInt i) : Out of bounds operation: index superior to size of array    IBM_20171023_indexInEmptySet        Unknown    OPL Problem Marker

    // model_file

    tuple Tu_name_value {
      key string name;
      float value;
    }

    {Tu_name_value} DATA = ...;
    {Tu_name_value} DATA_PERTURBATION = ...;


    {string} N = ...;

    float Qnow[v in N]   = item(DATA, <v>).value + ((<v> in DATA_PERTURBATION) ? item(DATA_PERTURBATION, <v>).value : 0);

    execute { writeln("Qnow = ", Qnow); }

    // data file

    DATA = {
    <"M_1", 1398.65718558>,
    <"M_2", -8391.9431135>,
    <"S", -20970.1664272>,
    <"CH", -35667.2359386>
    };

    DATA_PERTURBATION = {};

    N = {"M_1", "M_2", "S", "CH"};

     

    What is wrong with it ? How come is it no longer supported ?

    Thanks for your help !

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: tuple in tupleSet does not work anymore

    Posted Mon October 23, 2017 08:52 AM

    Hi,

    can you change

    float Qnow[v in N]   = item(DATA, <v>).value + ((<v> in DATA_PERTURBATION) ? item(DATA_PERTURBATION, <v>).value : 0);

    into

    float Qnow1[v in N]   = item(DATA, <v>).value;
    float Qnow2[v in N]   = ((<v> in DATA_PERTURBATION) ? item(DATA_PERTURBATION, <v>).value : 0);
    float Qnow[v in N]   = Qnow1[v]+Qnow2[v];

    ?

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: tuple in tupleSet does not work anymore

    Posted Mon October 23, 2017 08:57 AM

    Originally posted by: ouaigooo


    Hi Alex,

    workaround works well ,thanks (but makes the code longer and less elegant)

    I didn't make any syntax-error, right ?

    So are you guys going to fix this bug in the next release ?

    Kind regards -- Lucien
     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer