Decision Optimization

Decision Optimization

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

 View Only
Expand all | Collapse all

random tuple

  • 1.  random tuple

    Posted Sat October 01, 2016 05:42 AM

    Originally posted by: Treee


    hi,

    is it possible to generate a tuple with a random set of a and b with random values?

    so something like 

    tuple randomData { // 1-5 tuples with int a and int b

    int w; //between 5 and 10

    int d; // between 1 and 10

    }

    So this should be f.e. like :

    RandomData1 = { <6 2> <10 8>};

    or 

    RandomData1 { < 7 8 > <5 1> < 9 3>};

     

    kind regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: random tuple

    Posted Sat October 01, 2016 10:18 AM

    Hi,

    what about

    tuple randomData { // 1-5 tuples with int a and int b

    int w; //between 5 and 10

    int d; // between 1 and 10

    }

    {randomData} RandomData1={<5+rand(6),1+rand(10)> | i in 1..20};

    assert forall(<w,d> in RandomData1) (w in 5..10) && (d in 1..10);

    execute
    {
    writeln(RandomData1);
    }

    which gives

    {<6 2> <7 10> <8 9> <8 1> <10 3> <10 1> <6 8> <7 8> <5 9> <9 8>

    <9 10> <8 10> <10 7> <9 4> <9 6> <8 4> <9 9> <10 9>}

    regards

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer