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

Paul Adams paul.adams at evogro.com
Mon Oct 15 18:30:27 EDT 2012


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!)

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 :-)

I would appreciate any guidance as to how I might model this problem, or any simplifications I could make.

Many thanks,
Paul.


More information about the rules-users mailing list