[rules-users] Re: [drools-solver] help for defining my drools model / moves

Geoffrey De Smet ge0ffrey.spam at gmail.com
Mon Jun 29 13:00:25 EDT 2009


I call this problem a "score trap".

The problem is that your moves are to fine grained relatively to the 
rewarding aspect of the score function.

Here are some options:

1) You could introduce an extra bigger move (with a seperate movefactory 
so you can configure relativeSelections independently of your currrent 
movefactories and evaluate the union of those generated moves) which 
creates a new availability and immediatly fills in appointments and 
resources too.

In the examination problem for example, you 'll see 3 moves:
RoomChangeMove & PeriodChangeMove (fine grained)
ExamSwitchMove (course grained as it moves 2 exams, both in room and period)

2) You could also change the rewarding aspect of your score function to 
avoid score traps. Like a chosen availability with less then 5 resources 
doesn't trigger the constraint.

In the manners2009 problem for example, you 'll see the extra score rule 
atLeastOneJobTypePerTableScoreGuider:
- twoSameJobTypePerTable: punish all tables without 2 of a profession
- atLeastOneJobTypePerTableScoreGuider: punish all tables with 1 of a 
profession even harder
The SeatDesignationSwitchMove can only move 1 profession at a time at a 
table, so without atLeastOneJobTypePerTableScoreGuider it would have no 
insentive to move 1 profession to a table with 0 of that profession.

3) On trunk you can plug in a custom deciderScoreComparatorFactory and a 
custom ScoreDefinition. Keep the annoying constraint separately in the 
Score and make your deciderScoreComparatorFactory ignore it every 50 
steps for a duration of 10 steps.

With kind regards,
Geoffrey De Smet


Laurent Michenaud schreef:
> Hi,
> 
> Here is my test :
> I have an appointment to schedule on a customer availability.
> I have a list of customer availabilities.
> A customer availability is a period.
> An appointment needs an exact number of persons.
> A resource is composed of persons ( between 1 and n ) and has availabilities too.
> 
> The problem is to schedule the appointment : it has to choose the
> right resource availabilities that matches one of the customer availabilities and 
> the total number of persons inside chosen resources must match exactly the 
> needed number of persons of the appointment.
> 
> My moves are for the moment :
> - Change the customer availability.
> - Add a resource to the list of chosen resources.
> 
> My init is :
> - One of the customer availability is taken
> - 0 resource taken.
> 
> First, i don't know if my model and my init are ok.
> Secondly, the solver does the following :
> 
> - At the beginning, the score is bad because there is no resource.
> So, it begins adding resource and the score is getting better
> but when it changes the availability, the score gets very bad either because
> the chosen resources don't match the new availability or it has no resource
> inside. The solver doesnot seem to interest in the new chosen availibity with no
> resource, but i wish it does.
> 
> Thanks for your remarks/help
> 
> Best regards
> 
> 
> 
> 
> 
> 
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
> 




More information about the rules-users mailing list