[rules-users] Continuous Planning values for task planning
Josef Bajada
josef.bajada at gmail.com
Mon Jul 23 10:26:55 EDT 2012
Hi Geoffrey,
Well I want to leave 'space' between tasks in the situations where there
are hard constraints that require me to put this space.
As a simple example:
Task A: Put pasta in boiling water (duration 40 seconds)
Task B: Take pasta out of boiling water (duration 50 seconds, cannot start
before 7 mins after Task A finishes, cannot start after 8 mins after Task A
finishes)
Task C: Chop vegetables (duration 2 minutes).
This will evidently leave some gaps. The ideal result from the solver
should be:
Task A: at time 0 (ends at 40s)
Task C: at time 41s (ends at 2:41)
Task B: at time 7:40
There is a gap between C and B which is OK.
If another Task is added to the story:
Task D: Prepare sauce (duration 7 minutes)
I would want the following result:
Task A: at time 0 (ends at 40s)
Task D: at time 41s (ends 7:41s)
Task B: at time 8:42s (ends 9:32s)
Task C: at time 9:33s (ends 11:33s)
Task C can actually take place before Task A too.
I still need to read and understand the chaining functionality properly. Do
you think it would allow me to achieve the above?
thanks,
Josef
On 22 July 2012 20:05, Geoffrey De Smet <ge0ffrey.spam at gmail.com> wrote:
> Presuming that you don't want to leave space between tasks, you can
> design your model differently by using the "chained" functionality:
> it will be far more efficient and the planning variable won't be
> continuous.
>
> Let's presume you're scheduling Tasks to Persons.
>
> @PlanningEntity
> class Task implements TaskOrPerson {
>
> ...
>
> @PlanningVariable(chained = true)
> @ValueRanges({
> @ValueRange(type = ValueRangeType.FROM_SOLUTION_PROPERTY,
> solutionProperty = "taskList"),
> @ValueRange(type = ValueRangeType.FROM_SOLUTION_PROPERTY,
> solutionProperty = "personList",
> excludeUninitializedPlanningEntity = true)})
> public TaskOrPerson getPreviousTaskOrPerson() {
> return previousTaskOrPerson;
> }
>
> public int getDuration() {
> return duration;
> }
>
> public int getStartingTime() {
> int startingTime = 0;
> TaskOrPerson taskOrPerson = getPreviousTaskOrPerson();
> while (taskOrPerson instanceof Task) { // Every chain is
> guarantee to end up with an anchor (= Person)
> startingTime += ((Task) taskOrPerson).getDuration();
> taskOrPerson = ((Task)
> taskOrPerson).getPreviousTaskOrPerson()
> }
> return startingTime;
> }
>
> }
>
> class Person implements TaskOrPerson {
>
> }
>
> For a good example, take a look at the VehicleRouting example.
> For more info about chaining, in the manual see section 4.3.4.2.6. Chained
>
> http://docs.jboss.org/drools/release/5.4.0.Final/drools-planner-docs/html_single/index.html
>
> Op 22-07-12 18:00, Josef Bajada schreef:
>
> Hi,
>
> I am new to Drools and Drools Planner, so apologies if I am asking
> anything obvious.
>
> My objective is to implement a simple (for now) planner which schedules
> tasks according to 2 main criteria:
> - Their duration (in seconds)
> - Their dependencies on other tasks (e.g. Hard Constraint that Task B has
> to start between 180 and 200 seconds after Task A finishes).
>
> Since there are gaps between dependent tasks as part of the hard
> constraints other tasks can be fitted in between dependent tasks.
> So the Solver needs to find the optimal start time for each task that
> satisfies the hard constraints, and in the shortest total timeline possible
> to complete all tasks (soft constraint).
>
> The main problem I am finding is that this start time, which is
> essentially the planning variable is a continuous variable.
> Chapter 4 of the Drools documentation mentions very briefly (Section
> 4.3.4.1) that planning variables can be continuous, but there does not
> seem to be any more details about how to achieve this.
>
> Even if the planning variable was discrete (say bins of 5 second
> intervals), there is no upper bound as such.
>
> How is it best to handle such planning variables in Drools Planner?
>
> thanks,
> josef
>
>
>
>
> _______________________________________________
> rules-users mailing listrules-users at lists.jboss.orghttps://lists.jboss.org/mailman/listinfo/rules-users
>
>
> --
> With kind regards,
> Geoffrey De Smet
>
>
> _______________________________________________
> 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/20120723/be8197db/attachment.html
More information about the rules-users
mailing list