Good Afternoon, I want to do a question, i'm working with OptaPlanner and I have problems to build a hard constraint, maybe you could help me; I'm confused, the problem that I'm trying to build is:
- I have many trips, and I need to combine in order to use a minimum number of vehicles; the only constraint that I have is that de end of the trip (n) must be less than the start of the next trip (n+1), I make this drl rule but it doesn't work because this only make a group of two trips and a vehicle can make ten trips.
this is my rule
rule "horaInicioFin"
when
$leftAssignment : Trip(vehiculo!=null, $leftId : hinicio, $carrito : vehiculo);
$rightAssigment : Trip(vehiculo == $carrito, hinicio>=$leftId, calculateOverlap($leftAssignment, hinicio, idTrip)<0);
then
scoreHolder.addHardConstraintMatch(kcontext, - 1);
end