Decision Optimization

 View Only
Expand all | Collapse all

dvar to int

  • 1.  dvar to int

    Posted Sun July 05, 2015 02:04 PM

    Originally posted by: a35392@ua.pt


    Greetings.

    I'm new to CPLEX and I have a problem that may have an easy solution, which I can not find.

    Being ''a[i]" an input, int a[]=....

    and "b" a decision variable, dvar int+ "b[i]",

    how can I internally replace a[i], for b[i], or create a non decision variable equal to b, after optimizing b?

     

    Thanks in advance.


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: dvar to int

    Posted Mon July 06, 2015 02:45 AM

    Hi,

    let me give you a small example:

    range r=1..2;

    int a[i in r]=i+1;

    dvar int+ b[r];

    subject to
    {
    forall(i in r) b[i]==a[i]+1;
    }

    execute
    {
    for(var i in r) a[i]=b[i];
    writeln(a);
    }

    that gives [3 4]

     

    regards

     

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer