Topic
2 replies Latest Post - ‏2014-01-28T01:12:13Z by qtbgo
qtbgo
qtbgo
111 Posts
ACCEPTED ANSWER

Pinned topic main flow control problem

‏2014-01-27T02:00:54Z |

Hi, I want to run a model with a sequence of dat. The model is as follows, here we have two dat files  to solve. But it report errors, My main block maybe incorrect, can anyone point out how to achieve my purpose.  The mod and the dat files are attached. 

 
 
using CP;
 
 
int n = ... ;  //ship number
int m = ... ; //berth number
 
int p[i in 1..n] = ...; //
 
 
int a[i in 1..n] = ... ; //arrival time of ship i.
int d[i in 1..n] = ... ; //
int w[i in 1..n] = ...; //
 
int T =...; // max(i in 1..n)a[i] + sum(i in 1..n)p[i]; //
 
 
int depth[k in 1..m][t in 1..T] =...; //
 
int draft[i in 1..n] = ...; //
 
 
dvar interval tasks[i in 1..n] in 0..T size p[i]; //
 
 
 
 
minimize  max(i in 1..n)endOf(tasks[i]); //
          
subject to {
   
  
};  
 
 
main{
 
 
  thisOplModel.generate();
  var masterDef = thisOplModel.modelDefinition; 
  var masterCP = new IloCP();
 
 for (var i=1; i<=2; i++)
 {
 
  var masterOpl = new IloOplModel(masterDef,masterCP);
  var dataName = 9+"_"+i+".dat";
  var masterDataSource = new IloOplDataSource(dataName);
  masterOpl.addDataSource(masterDataSource);
  
  masterOpl.generate(); 
  masterCP.startNewSearch(); 
  while(masterCP.next()) 
   {
  writeln("obj = ", masterCP.getObjValue(),  " | time = ", masterCP.info.SolveTime);
   } 
  masterCP.endSearch();  
  masterOpl.end();
   
 };
   
 

Attachments

  • ol
    ol
    14 Posts
    ACCEPTED ANSWER

    Re: main flow control problem

    ‏2014-01-27T13:46:43Z  in response to qtbgo

    Hello,

    it works on my PC with the files you sent, with OPL version 12.5.1.

    What is your version? and what is the error you get?

    Olivier

    • qtbgo
      qtbgo
      111 Posts
      ACCEPTED ANSWER

      Re: main flow control problem

      ‏2014-01-28T01:12:13Z  in response to ol

      you are right, it works. I made a mistake in configuration