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

Narasinga Rao miniskar at imec.be
Sun Nov 23 10:52:52 CET 2008


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/20081123/a26b7142/attachment.htm>


More information about the gecode-users mailing list