Decision Optimization

Decision Optimization

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

 View Only
Expand all | Collapse all

How to read tuple(there is an one-dimensional array in tuple) from an excel

  • 1.  How to read tuple(there is an one-dimensional array in tuple) from an excel

    Posted Thu September 05, 2019 09:48 AM

    Originally posted by: Sultan_Niz7755


    Hello everyone.

    I have to read tuple from an excel sheet. 

    example:

    Pat={<1,2,[1,2,3,4]>,
     <2,3,[1,2,3,4]>,
     <3,4,[1,2,3,4]>,
     <4,2,[1,2,3,4]>,
     <5,2,[1,2,3,4]>,
     <6,2,[1,2,3,4]>,
     <7,2,[1,2,3,4]>,
     <8,2,[1,2,3,4]>,
     <9,2,[1,2,3,4]>,
     <10,2,[1,2,3,4]> 
     };

    Thank you very much for your answer.

    Best regards,

    Sherzod


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: How to read tuple(there is an one-dimensional array in tuple) from an excel

    Posted Thu September 05, 2019 09:55 AM

    Hi,

    I would read a tuple set with 6 components a,b,c,d,e,f that I would turn in the .mod into a tuple with an array inside

    regards

    https://www.linkedin.com/pulse/making-decision-optimization-simple-alex-fleischer/


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: How to read tuple(there is an one-dimensional array in tuple) from an excel

    Posted Thu September 05, 2019 10:10 AM

    Originally posted by: Sultan_Niz7755


    Hi,

    Thank you very much, Alex.

    I will do as you said.

    Best regards,

    Sherzod

     

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: How to read tuple(there is an one-dimensional array in tuple) from an excel

    Posted Thu September 05, 2019 10:14 AM

    Hi,

    as a start:

    .mod

    tuple t
    {
    int a;
    int b;
    int c;
    int d;
    int e;
    int f;
    };

    {t} Pat=...;

    tuple t2
    {
    int a;
    int b;
    int g[1..4];
    }

    t2 Pat2[i in Pat];

    execute
    {
    for(var i in Pat)
    {
    Pat2[i].a=i.a;
    Pat2[i].b=i.b;
    Pat2[i].g[1]=i.c;
    Pat2[i].g[2]=i.d;
    Pat2[i].g[3]=i.e;
    Pat2[i].g[4]=i.f;
    }
    }

     

    .dat

     

    Pat={<1,2,1,2,3,4>,
     <2,3,1,2,3,4>,
     <3,4,1,2,3,4>,
     <4,2,1,2,3,4>,
     <5,2,1,2,3,4>,
     <6,2,1,2,3,4>,
     <7,2,1,2,3,4>,
     <8,2,1,2,3,4>,
     <9,2,1,2,3,4>,
     <10,2,1,2,3,4>
     };

    regards


    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: How to read tuple(there is an one-dimensional array in tuple) from an excel

    Posted Thu September 05, 2019 11:02 AM

    Originally posted by: Sultan_Niz7755


    Thank you very much, Alex. It is working fine.  

    I appreciate your quick answer.

    Best regards,

    Sherzod


    #CPLEXOptimizers
    #DecisionOptimization