Topic
  • 4 replies
  • Latest Post - ‏2014-06-05T15:34:30Z by USMC
USMC
USMC
5 Posts

Pinned topic Strange Results Generating .lp files from OPL

‏2014-05-30T20:18:15Z |

Some of my variables generate looking like this:  Y#0#0#0 + 2 Y#0#0#1 + 3 Y#0#0#2 +   They should be Y(111), Y(112), Y(113)

Yet others work ok:  For example: W(1) W(2)

Why does this happen?

Also, the objective function has the following variable in it:  Slack(15) + x151  The slack variable should be there but the x variable shouldn't.  Besides that as mentioned above, the X variables in my model genarate as X#0#4#0.

Of course from a purely theoretical standpoint none of this matters as long as I know what the variables mean.  But, it makes it hard to interpret results.  Below I have copied the appropriate pieces from my mod file and my dat file.

 

int NbProducts = ...;
int NbPlates = ...;
int NbPositions = ...;
int MaxPositions = ...;
range Products = 1..NbProducts;  // i variable
range Plate = 1..NbPlates; // j variable
range Usage = 1..MaxPositions; // k variable
float Demand[Products] = ...;
float M = 1000000;
 
 
dvar float+ Y[Products][Plate][Usage];
dvar int X[Products][Plate][Usage] in 0..1;
dvar int Z[Products][Products][Plate] in 0..1;
dvar float+ TP[Products];  //This variable is just to count total production
dvar float+ Slack[Products]; // This variable is just to report over production

 

Notice there is no "x" in the objective function:

minimize
  sum(i in Products, j in Plate, k in Usage) k * Y[i][j][k] +
  sum(i in Products)(1 / Demand[i]) * Slack[i];

 

Here is the dat file:

NbProducts = 15;
NbPlates = 3;
NbPositions = 8;
MaxPositions = 3;
Demand = [4213,12765,20591,21382,26418,27001,32363,33062,53916,54092,57392,58492,72295,91245,97628]
;

 

dvar float+ W[Plate]; //This will be used to determine how many times each plate is used
  • AlexFleischer
    AlexFleischer
    1472 Posts

    Re: Strange Results Generating .lp files from OPL

    ‏2014-05-31T19:55:50Z  

    Hi

    I gave some answers at

     

    https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014814080

    Could that help ?

    regards

     

  • USMC
    USMC
    5 Posts

    Re: Strange Results Generating .lp files from OPL

    ‏2014-06-03T11:38:21Z  

    Sorry for the delay, I have been at a conference.

    That seems to be what I need, but I can't get it to work.  Here is the relevant section of my code:

    execute CPX_PARAM 
    {
      cplex.tilim = 0;
      bigMapThreshold = 100000;   
    }

    Here is the error message:

     
    Not a model element "bigMapThreshold", use 'var' to declare local scripting variables.
     

    I have also tried modifying the code:

    execute CPX_PARAM 
    {
      cplex.tilim = 0;
      cplex.bigMapThreshold = 100000;   
    }
    I get a slightly different error, but it still doesn't work.

     

    Description Resource Path Location Type
    Execution of "CPX_PARAM" failed: "C:\Users\user\opl\Problem 12 add command to generate properly\Carton Paper ModelSecond Symmetry Constraint.mod", line 28: cannot set the 'bigMapThreshold' property: 100000. Carton Paper ModelSecond Symmetry Constraint.mod /Problem 12 add command to generate properly 25:2-9 C:\Users\user\opl\Problem 12 add command to generate properly\Carton Paper ModelSecond Symmetry Constraint.mod OPL Problem Marker
    Scripting runtime error: cannot set the 'bigMapThreshold' property, "100000". Carton Paper ModelSecond Symmetry Constraint.mod /Problem 12 add command to generate properly 28:0 C:\Users\user\opl\Problem 12 add command to generate properly\Carton Paper ModelSecond Symmetry Constraint.mod OPL Problem Marker
     
  • AlexFleischer
    AlexFleischer
    1472 Posts

    Re: Strange Results Generating .lp files from OPL

    ‏2014-06-04T07:35:22Z  
    • USMC
    • ‏2014-06-03T11:38:21Z

    Sorry for the delay, I have been at a conference.

    That seems to be what I need, but I can't get it to work.  Here is the relevant section of my code:

    execute CPX_PARAM 
    {
      cplex.tilim = 0;
      bigMapThreshold = 100000;   
    }

    Here is the error message:

     
    Not a model element "bigMapThreshold", use 'var' to declare local scripting variables.
     

    I have also tried modifying the code:

    execute CPX_PARAM 
    {
      cplex.tilim = 0;
      cplex.bigMapThreshold = 100000;   
    }
    I get a slightly different error, but it still doesn't work.

     

    Description Resource Path Location Type
    Execution of "CPX_PARAM" failed: "C:\Users\user\opl\Problem 12 add command to generate properly\Carton Paper ModelSecond Symmetry Constraint.mod", line 28: cannot set the 'bigMapThreshold' property: 100000. Carton Paper ModelSecond Symmetry Constraint.mod /Problem 12 add command to generate properly 25:2-9 C:\Users\user\opl\Problem 12 add command to generate properly\Carton Paper ModelSecond Symmetry Constraint.mod OPL Problem Marker
    Scripting runtime error: cannot set the 'bigMapThreshold' property, "100000". Carton Paper ModelSecond Symmetry Constraint.mod /Problem 12 add command to generate properly 28:0 C:\Users\user\opl\Problem 12 add command to generate properly\Carton Paper ModelSecond Symmetry Constraint.mod OPL Problem Marker
     

    Hi,

    can you try

    execute
    {
     thisOplModel.settings.bigMapThreshold=100000;
     writeln(thisOplModel.settings.bigMapThreshold);
    }

    ?

     

    regards

  • USMC
    USMC
    5 Posts

    Re: Strange Results Generating .lp files from OPL

    ‏2014-06-05T15:34:30Z  

    Alex,

    Yes, that worked.  Apparently it is case sensitive.  

    I was hoping that would also work with one of my writeln statements but that still fails.

     

    writeln("Time == " , thisOplModel.settings.get_Time());

     

    It also fails without the "thisOplModel.settings" part.