As I understand it, the time language in drools-fusion applies to fusion
events (CEP). Your appointments and timeslots are actually normal drools
facts, not fusion events, so I doubt it's possible to apply that time
language meaningfully.
However it should be possible to do things like this:
when
firstTimeSlot : Timeslot(firstDate : date)
secondTimeSlot : TimeSlot(secondDate : date)
eval(JodaTimeHelper.isSameWeek(firstDate, secondDate)
...
then ...
As you can see, I 'd suggest using JodaTime instead of Date&Calendar,
because it comes with methods to determine if it's the same day, week,
etc reliably. Hopefully JSR-310 (=standarized JodaTime) will make Java 7.
If you do want to (or have to) continue torturing yourself with
Date&Calendar: apache's commons-lang has some of those methods already
implemented.
Either way, drools-solver doesn't care and can work with both :)
As for real-time changes while drools-solver is planning:
The new Solver.cancel() method allows you to cancel solving,
so you can apply those changes and then you can call Solver.solve()
again to continue from the last best score.
However, you 'll need to use some java.concurrent stuff
(ExcecutorService), probably a Latch, to wait for the solver to finish
on the solver thread (after calling cancel()), before applying the
changes in your changingAndCanceling thread.
With kind regards,
Geoffrey De Smet
Wim Vancroonenburg schreef:
That makes a lot of sense. Metaheuristics and local search methods
(which Drools Solver supports) are great for creating schedules, roster,
plannings, ... . I've been using Drools Solver for a bed assignment
problem in health care (more of a benchmark problem) and it performs
well. Colleagues of mine are solving exam-timetables and
course-timetables with metaheuristics, so these type of problems should
be equally doable with Drools Solver.
Drools Solver does not have any time "operators" like Nicolas says, that
is something that your model should implement.
Sincerely,
Wim Vancroonenburg
Greg Barton wrote:
> Well, Fusion is mainly geared towards processing incoming dynamic
> events.
> Drools-solver would be best for creating the appointment schedule.
> However, if you want to react to real time changes that may affect
> your schedule, you could always use drools-fusion for that. (i.e. we
> have an appointment for Bob, Alice, and Chuck in Room D on Monday.
> Then an event comes in saying Chuck is sick within 30 minues of the
> appointment. If Chuck is a critical member of the meeting the system
> decides to reschedule, but without the "only on Mondays" constraint.)
> So drools-solver would create the schedule, and drools-fusion would
> decide in real time based on the current schedule structure and the
> incoming events whether to respaawn a solver session to adjust the
> schedule. Does that make sense?
>
> --- On Thu, 5/7/09, Damien Raude-Morvan <drazzib(a)drazzib.com> wrote:
>
>> From: Damien Raude-Morvan <drazzib(a)drazzib.com>
>> Subject: Re: [rules-users] Drools : usage as appointment booking
>> engine ?
>> To: "Rules Users List" <rules-users(a)lists.jboss.org>
>> Date: Thursday, May 7, 2009, 10:50 AM
>>> Hello,
>> Hi Nicolas,
>>
>>> you should look at drools-solver
>>> here is a link to the
>>>
>>
documentation<http://hudson.jboss.org/hudson/job/drools/lastSuccessful...
>>
>>
>> Thanks this documentation, I was using oudated
>> documentation from
>>
http://users.telenet.be/geoffrey/tmp/solver/manual/html_single/
>> .
>>
>> I've evaluated drools-solver, for example trying to
>> evolve
>> "lessonschedule" sample to include some time
>> constraints but I failed to
>> use time "operators" in drools solver.
>>
>> I found Drools Fusion time constraints (before, inside,
>> meets) interesting
>> but for now haven't been able to build something with
>> it. Drools Fusion
>> "StockTick" sample seems oriented to STREAM event
>> and not to managing time
>> slots and constraints on this time slots.
>>
>> Anybody having experience with such problems ?
>>
>> Regards,
>>
>>> 2009/5/7 Damien Raude-Morvan
>> <drazzib(a)drazzib.com>
>>>> Hi,
>>>>
>>>> I'm evaluating use of Drools 5 as an
>> appointment booking engine.
>>>> My input data are :
>>>> - some time slots, defined with a start and end
>> time.
>>>> - some appointment constraints (only monday, only
>> morning, appointment
>>>> theorical duration)
>>>>
>>>> I've looked at Drools 5 Fusion without finding
>> a way to go with this.
>>>> Can someone give me some pointer / start URL about
>> how to solve this
>>>> kind
>>>> of problems ?
>> --
>> Damien Raude-Morvan /
www.drazzib.com
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users(a)lists.jboss.org
>>
https://lists.jboss.org/mailman/listinfo/rules-users
>
>
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/rules-users
>
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users