Topic
2 replies Latest Post - ‏2013-10-03T13:05:39Z by HuiD
HuiD
HuiD
30 Posts
ACCEPTED ANSWER

Pinned topic SheetWrite not working with oplrun

‏2013-10-03T10:27:18Z |

Hi,  I read input data from Excel file. SheetRead works fine. But recently I need to update the data in the same file. so I use SheetWrite. 

However, I find that it works in the IDE but not in the command line. When the problem becomes bigger, it's really not efficient with IDE. 

Does anyone know how to solve this problem?

Thanks,

Hui

  • AlexFleischer
    AlexFleischer
    1031 Posts
    ACCEPTED ANSWER

    Re: SheetWrite not working with oplrun

    ‏2013-10-03T12:16:48Z  in response to HuiD

    hi,

    can you attach the model and data files ?

    regards

    • HuiD
      HuiD
      30 Posts
      ACCEPTED ANSWER

      Re: SheetWrite not working with oplrun

      ‏2013-10-03T13:05:39Z  in response to AlexFleischer

      in the .mod file:

      Time = 1..12;

      {link} topo = ...;

      {demand} traffic = ...;

      int previous[t in Time][l in topo] = ...;

      dvar boolean C[t in Time][d in traffic][l in topo];

      dexpr int exist[t in Time][l in topo] = sum(d in traffic)C[t][d][l]*d.rate;

       

      the .dat file

      SheetConnection input("data.xls");

      topo from SheetRead(input, "Sheet1!A1:C5");

      traffic from SheetRead(input, "Sheet2!A1:C3");

      previous from SheetRead(input, "Sheet3!A1:H5");

      exist to SheetWrite(input, "occupied");

       

      The "exist" matrix is used to update the "previous". Previously, I wrote A1:H5 in the data file and it won't work in either IDE or oplrun. Then I name the range A1:H5 in Sheet3 as "occupied" and it works in IDE, but not in oplrun.