[rules-users] Egg Planning: number of facts is also a planning variable

Geoffrey De Smet ge0ffrey.spam at gmail.com
Tue Oct 16 03:57:15 EDT 2012


Op 16-10-12 00:30, Paul Adams schreef:
> Hi everyone,
>
> I'm new to Drools, so apologies if I'm missing something obvious or mixing up my terms here. Hopefully the subject line got someone's attention!
>
> My problem is this (somewhat contrived and simplified):
>
> Facts:
>
> 1. A person would like to eat 3 eggs per day, of each of several different breeds (Legbar, Rhode Island Red, Dorking)
> 2. A hen takes 45 days to get to egg-laying stage (varies by breed)
> 3. At maturity, each hen lays  2 eggs every 10 days (also varies by breed)
> 4. A hen house has 30 available roosts
> 5. Each hen can lay 5 times before they give up (luckily for us this isn't really true!)
lol! I wonder what you're really planning ;)

I would expect that:
@PlanningEntity HenAssignment {
    Hen hen; // a Hen has a Breed
    @PlanningVariable Roost roost;
    @PlanningVariable Day startingDay;
}
I am not sure if your number of Hens is static or dynamic.

<note>
If it's dynamic you might want to consider this alternative:
@PlanningEntity EggDonation {
    Day day;
    @PlanningVariable Hen hen;
    @PlanningVariable Roost roost;
}
Which might be better of split up 2 entity classes (but until the placer 
API is released, construction heuristics don't support that well)
</note>
>
> My planning problem is to figure out how many chicks I need to buy, when I need to buy them, and to allocate them to a particular roost for their entire egg-laying life. Basically what I would like the solution to contain is an allocation of a particular hen to a roost for a particular period, when the eggs will appear, and when a roost will become free to plan more hens.
>
> Hard Constraint:
>
> No hen can share the same roost
>
> The problem feels like the hospital bed problem in the examples, but where the number of patients is both a planning variable and a fact, and the planning period is undefined. As I said, the problem is paraphrased and simplified - there are a number of soft constraints - some hens like it hot :-)
It's basically hospital bed planning but without a plannable admission 
date, but with no need that a patient can switch beds ever.

Take a look at this post:
   https://plus.google.com/112811208792575157490/posts/82h37pBvQ5m
>
> I would appreciate any guidance as to how I might model this problem, or any simplifications I could make.
>
> Many thanks,
> Paul.
> _______________________________________________
> 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