I have a question on the cumulatives constraint. I have a simple case
where I expect more pruning on the start variable and I just want to
make sure if my expectation is correct (before digging into the paper
and implementation):
The case is two tasks both assigned to the same single machine, first
task starts at 0 and ends at 20, second tasks has a duration of 20 can
initially start between 0 and 40 and end between 20 and 60. The
machine has limit 1 and the amount used of the resource should be less
(at_most=true) than the limit and the height of both tasks is 1.
I would expect the start of the second variable to be pruned from
[0,40] to [20,40] but what we see (when we run the attached file) is a
search on the start variable failing 20 times (trying start
0,1,2,...19) before finding the first solution. Obviously I expect the
first decision to be a solution. Am I expecting to much propagation on
a task without compulsory part?
David Rijsman
#include "examples/support.hh"
#include "gecode/minimodel.hh"
class CumulativesCase : public Example {
protected:
;
IntVarArray start;
IntVarArray end;
public:
/// Actual model
CumulativesCase(const Options& opt)
: start(this,2,0,60),end(this,2,0,60)
{
IntArgs machine(2,0,0);
IntArgs duration(2,20,20);
IntArgs height(2,1,1);
IntArgs limit(2,1,1);
/// First task starts at 0 ends at 20
rel(this, start[0], IRT_EQ, 0);
cumulatives(this,machine,start,duration,end,height,limit,true);
branch(this, start,INT_VAR_SIZE_MIN,INT_VAL_MIN);
}
/// Constructor for cloning \a s
CumulativesCase(bool share, CumulativesCase& s) : Example(share,s) {
start.update(this, share, s.start);
end.update(this, share, s.end);
}
/// Copy during cloning
virtual Space*
copy(bool share) {
return new CumulativesCase(share,*this);
}
};
/** \brief Main-function
*/
int
main(int argc, char* argv[]) {
Options opt("CumulativesCase");
opt.solutions(1);
opt.parse(argc,argv);
Example::run<CumulativesCase,DFS,Options>(opt);
return 0;
}
_______________________________________________
Gecode users mailing list
[EMAIL PROTECTED]
https://www.gecode.org/mailman/listinfo/gecode-users