setcplexoplilog

How to write this set in CPLEX


Let Set B={4,2,8,6,5};

how to write below sets in CPLEX

Set E={p| for all b∈B , p=random integer in range(0,b)}

Set F= {Set of all E} (need multiple sets of E using varying random integers p)


Solution

  • {int} B={4,2,8,6,5};
    
    range r=1..4;
    
    {int} E[i in r]={rand(b) | b in B};
    
    tuple f
    {
      {int} s;
    }
    
    {f} F={<E[i]> | i in r};
    
    execute
    {
      writeln(F);
    }
    

    gives

    {<{0 2 4}> <{3 1 0 5}> <{0 5 2 3}> <{3 1 6 4}>}
    

    but could give other results (random) ....