Decision Optimization

Decision Optimization

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

 View Only
Expand all | Collapse all

Expression with tuple

  • 1.  Expression with tuple

    Posted Mon July 31, 2017 07:59 AM

    Originally posted by: sandeepsinghchauhan


    tuple Raw
    {
    key int Rawtype;
    float Rawamount;
    }
    {Raw} RawAvail = ...;

    dexpr float rawConsume[r in RawAvail] = sum ( dr in Rawperprocess:dr.Rawtype == r)(dr.Rawreq*1000);

     

    Rawtype have two values (1 or 2). So above expression I want to write only for Rawtype value equal to 1.


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: Expression with tuple

    Posted Mon July 31, 2017 11:52 AM

    Hi,

     tuple Raw
    {
    key int Rawtype;
    float Rawamount;
    }

    tuple t
    {
    int Rawtype;
    float Rawreq;
    }

    {Raw} RawAvail = {<1,2.0>,<2,3.0>};;

    {t} Rawperprocess ={<1,3.0>,<1,4.8>,<2,3.0>};

     

    dexpr float rawConsume[r in RawAvail] = sum ( dr in Rawperprocess:dr.Rawtype == r.Rawtype)(dr.Rawreq*1000);

    subject to
    {

    }

    execute
    {
    writeln(rawConsume);;
    }

    gives

    [7800 3000]

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer