[rules-users] Using EntitySelector (EntityFilterClass)

ge0ffrey ge0ffrey.spam at gmail.com
Thu Mar 14 04:59:21 EDT 2013


pppoole wrote
> I have a planning entity which has a "ResourceType" on it and I am
> attempting to schedule resources on the entity.  The Resource is the
> Planning variable and the Resource instance has a "ResourceType" on it as
> well.  I want to filter to make sure that a ResourceType matches between
> the PlanningEntity and the PlanningVariable prior to subjecting it to
> rules (since this is a hard constraint that can never be broken and want
> to save on performance).  For example, if my PlanningEntity calls for a
> resource of type "janitor", then I shouldn't assign a Resource
> (PlanningVariable) of type "teacher" to the event.  In order to filter
> these, I implemented a SelectionFilter class and validate that the
> entity's resource type matches the planning variable's resource type and
> return false if not.  This is definitely returning the correct values (I
> debugged this to confirm), but yet my final solution is still getting the
> wrong resource types on it.  
> 
> My implementation for my filter:
> 
>   public boolean accept(ScoreDirector scoreDirector, PlanningEvent
> selection)
>   {
>     return selection.getRequiredResourceType().getType()
>         .equals(selection.getResource().getResourceType().getType());
>   }
> 
> My configuration:
> <changeMoveSelector>
>      
> <entitySelector>
>                
> <entityFilterClass>
> com.lmco.mst.lss.autoscheduler.domain.move.RequiredTypeEntityFilter
> </entityFilterClass>
>      
> </entitySelector>
> </changeMoveSelector>
> Please advise, I am kind of stuck.
> 
> Thanks!

This thread continues here:
http://stackoverflow.com/questions/15394426/drools-planner-planner-not-providing-expected-result-based-on-best-score



--
View this message in context: http://drools.46999.n3.nabble.com/Using-EntitySelector-EntityFilterClass-tp4022770p4022818.html
Sent from the Drools: User forum mailing list archive at Nabble.com.


More information about the rules-users mailing list