Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  how to display one variable output into excel

    Posted 06/07/17 09:15 AM

    Originally posted by: khadeejah


    Hi all,

    i want one of my variables solution to be displayed in excel , how can i do so


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: how to display one variable output into excel

    Posted 06/07/17 09:34 AM

    Hi,

    you have an example in CPLEX_Studio127\opl\examples\opl\oil

    in .mod

    dvar float+ a[Gasolines];
    dvar float+ Blend[Oils][Gasolines];

    in .dat

    a to SheetWrite(sheet,"RESULT!A2:A4");
    Blend to SheetWrite(sheet,"RESULT!B2:D4");

    regards


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: how to display one variable output into excel

    Posted 06/08/17 09:35 AM

    Originally posted by: khadeejah


    Thanks Alex, i'll try it.


    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: how to display one variable output into excel

    Posted 06/08/17 10:04 AM

    Originally posted by: khadeejah


    I wrote: CHt to SheetWrite(sheet,"RESULT!A3:AV3");

    but i had an error :

    The sheet connection sheet is not defined


    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: how to display one variable output into excel

    Posted 06/08/17 10:27 AM

    Hi,

    have you written the SheetConnection part ?

    oilSheet.dat:

    SheetConnection sheet("oilSheet.xls");
    Gasolines from SheetRead(sheet,"'gas data'!A2:A4");
    Oils from SheetRead(sheet,"'oil data'!A2:A4");
    Gas from SheetRead(sheet,"'gas data'!B2:E4");
    Oil from SheetRead(sheet,"'oil data'!B2:E4");
    MaxProduction = 14000;
    ProdCost = 4;


    a to SheetWrite(sheet,"RESULT!A2:A4");
    Blend to SheetWrite(sheet,"RESULT!B2:D4");

    regards


    #CPLEXOptimizers
    #DecisionOptimization


  • 6.  Re: how to display one variable output into excel

    Posted 06/09/17 07:53 PM

    Originally posted by: khadeejah


    i wrote the syntax in the .dat as follows:

    SheetConnection sheet("results.xls");
    CHt to SheetWrite(sheet,"results!A3:AV3");

    but an error : file "results.xls" is not found.

    What am i doing wrong.

    P.s : all my solution is displayed normally in the solution tab, i just want one of the decision variable solution to be written in the excel directly.


    #CPLEXOptimizers
    #DecisionOptimization


  • 7.  Re: how to display one variable output into excel

    Posted 06/10/17 08:49 AM

    Hi

    the file result.xls should already exist.

    OPL won t create it.

    regards


    #CPLEXOptimizers
    #DecisionOptimization


  • 8.  Re: how to display one variable output into excel

    Posted 06/10/17 02:08 PM

    Originally posted by: khadeejah


    it exists already.

    of course i created an excel and give it the name i put in the command 


    #CPLEXOptimizers
    #DecisionOptimization