[gecode-users] How to put constratins on sort order variables !

Christian Schulte cschulte at kth.se
Mon Nov 24 09:49:37 CET 2008


I cannot see from your program how startOrder and order are initialized as
variables. Then, the two first calls to post apparently are calls you
implemented yourself, so I again cannot see what is happening.

 

Christian

 

--

Christian Schulte, www.ict.kth.se/~cschulte/

 

From: users-bounces at gecode.org [mailto:users-bounces at gecode.org] On Behalf
Of Narasinga Rao
Sent: Sunday, November 23, 2008 10:53 AM
To: users at gecode.org
Subject: [gecode-users] How to put constratins on sort order variables !

 

Dear all, 

I would like to know how to post the constraints on sort order variables. 

The basic idea is 

1. First we need to order the tasks based on the start times (basically a
sorting based on start times)

2. Post some constraints on the derived ordered start times

 

Here is the example code...

IntVarArray start;
IntVarArray end;
IntVarArray startOrder;
IntVarArray order;

.....................
.....................
.....................
// start and end constraints are well defined
.....................
.....................
for( int i=0; i<nTasks; i++) {
      post( this, start, order[i], startOrder );
      post( this, end, order[i], endTimeStamps );
      if( i < nTasks-1 )
           post( this, startOrder[i] < startOrder[i+1] );
}

// Adding some post constraints on the ordered tasks
for( int i=0; i<nTasks-1; i++ ) {
     post( this, endTimeStamps[i] + switchingCost[i+1]  < startOrder[i+1] );
}

If we add the above constraint, it is not providing any solution. Instead if
we give the same constraints with predefined input order values like given
below, it is providing solution.

int order[] = { 0, 1, 2, 3, 4, 5 };
......................
for( int i=0; i<nTasks-1; i++ ) {
     post( this, endTimeStamps[i] + switchingCost[i+1]  < start[order[i+1]]
);
}

Can any body help me in providing the solution. 
Thanks in advance...

-- 
---------------------
With Regards,
Narasinga Rao, Miniskar,
IMEC, Belgium.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.ps.uni-sb.de/pipermail/users/attachments/20081124/1ee0822d/attachment.htm>


More information about the gecode-users mailing list