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

Paul Adams paul.adams at evogro.com
Tue Oct 16 08:59:17 EDT 2012


Hi Geoffrey, thanks for the reply,

On 16 Oct 2012, at 08:57, Geoffrey De Smet wrote:

> 
> 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 number of hens should be dynamic. Ideally I would like given a requirement in eggs/day for the number of hens to be calculated, so it sounds like the second model is close. In this case, what would the annotation be for @ValueRange since the Hen entities would be presumably created on the fly during planning? Another way which I thought about would be to start with a large number of 'potential Hens' and to kill them off as we discovered we didn't need them to produce the required quantity of eggs, similar to computers in the cloud processing example, or if we didn't find a good solution, try running it again with more Hens. This would then fit in to model 1.

The second aspect which I would like to know is the Day when I should buy a chick in order that it can replace an egg-laying hen after 45 days, as this is a continuous production planning application. I suppose what we are really doing here is windowed planning. In model 1, the startingDay is planned, so I think that would work.

What is the placer API? Is it something I should be keeping an eye open for?

>> 
>> 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
>> 
> 
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20121016/fd35bb15/attachment.html 


More information about the rules-users mailing list