Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Excel write tuplr variable

    Posted 02/06/19 01:59 AM

    Originally posted by: sandeepsinghchauhan


    tuple pl
    {
    int p;
    int L;
    int c;
    }

    {pl} PL={<1,2,4>,<2,3,7>};

    tuple Proc
    {
    int a;
    }
    tuple TLU
    {
    Proc a;
    int b;
    int c;
    }
    {TLU} P = {<<1>,1,2>,<<2>,1,3>};

    int M[P]=[100,100];
    dvar int+ X[P];

    constraints

    {

    forall(dv in P){

    X[dv] <= sum(pl in PL,p in PL:pl.p == p.p && pl.L== dv.b+1)pl.c*M[dv]*29;

    }

    }

     

     

    How to write variable X values in excel?


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Excel write tuplr variable

    Posted 02/06/19 02:02 AM

    Hi,

    have you had a look at SheetWrite ?

    regards


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Excel write tuplr variable

    Posted 02/06/19 02:08 AM

    Originally posted by: sandeepsinghchauhan


    Yes I tried but that is not helping here

     

    SheetConnection d1("mNew.xlsx");
    X from SheetWrite (d1,"'Sheet1'!A1:C294");

     

    Error:
    Data parsing error: syntax error, unexpected SheetWrite, expecting DBRead or SheetRead or *Read.   

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: Excel write tuplr variable

    Posted 02/06/19 02:41 AM

    and with

    X to SheetWrite (d1,"'Sheet1'!A1:C294");

    ?

    Do not forget that you read from SheetRead so you use "from" and you write to with SheetWrite so you use "to"

    regards


    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: Excel write tuplr variable

    Posted 02/06/19 03:29 AM

    Originally posted by: sandeepsinghchauhan


    Since X is a tuple so it has a, b and c parameters. How can i write only b non zero values in X,  in excel?


    #CPLEXOptimizers
    #DecisionOptimization


  • 6.  Re: Excel write tuplr variable

    Posted 02/06/19 03:37 AM

    Hi,

    then in postProcessing you could write

    {TLU} nonZeros={dv | dv in P : X[dv]!=0};

    and then in the .dat you will SheetWrite nonZeros

    regards


    #CPLEXOptimizers
    #DecisionOptimization


  • 7.  Re: Excel write tuplr variable

    Posted 02/06/19 03:58 AM

    Originally posted by: sandeepsinghchauhan


    It is able to gives only nonzero parameter value  but in addition to parameter value; I also wants their corresponding X value.

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 8.  Re: Excel write tuplr variable

    Posted 02/06/19 04:13 AM

    Then

    {TLU} nonZeros={dv | dv in P : X[dv]!=0};
        
        tuple result
        {
        int a;
        int b;
        int c;
        int X;    
        }
        
        {result} results={ <dv.a.a,dv.b,dv.c,X[dv]> | dv in nonZeros};

    regards


    #CPLEXOptimizers
    #DecisionOptimization