I am reviewing the time schedule example to organize the times and room to a specific lesson. However, the time in the example is doing the assumption that each class is 1 hour. Where can I find more information in Optaplanner? if I decide to change the hour to a predefined duration such as 1 hour, 2.5 hours depending of the lesson. Thanks!
Take a look at the Conference Scheduling example in optaplanner-examples (!= optaplanner-quickstarts).
In that case a Talk (= Lesson) is assigned to a Timeslot and a Room, but each talk has a talkType (for example "conference talk", "lab", "deep dive", "lighting talk", etc) and each timeslot has a requiredTalkType.
For performance reasons, it uses "value range from entity" (instead of "value range from solution"), so that requiredTalkType becomes a build-in hard constraints instead of an actual hard constraint.
Also read the docs section Assigning to time in the Design Patterns chapter. This is just the tip of the iceberg: there are other patterns too. Conference scheduling still uses the "timeslot pattern", because the "timegrain pattern" is often slow.
Related
I am applying the VRP example of optaplanner with time windows and I get feasible solutions whenever I define time windows in a range of 24 hours (00:00 to 23:59). But I am needing:
Manage long trips, where I know that the duration between leaving the depot to the first visit, or durations between visits, will be more than 24 hours. So currently it does not give me workable solutions, because the TW format is in 24 hour format. It happens that when applying the scoring rule "arrivalAfterDueTime", always the "arrivalTime" is higher than the "dueTime", because the "dueTime" is in a range of (00:00 to 23:59) and the "arrivalTime" is the next day.
I have thought that I should take each TW of each Customer and add more TW to it, one for each day that is planned.
Example, if I am planning a trip for 3 days, then I would have 3 time windows in each Customer. Something like this: if Customer 1 is available from [08:00-10:00], then say it will also be available from [32:00-34:00] and [56:00-58:00] which are the equivalent of the same TW for the following days.
Likewise I handle the times with long, converted to milliseconds.
I don't know if this is the right way, my consultation would be more about some ideas to approach this constraint, maybe you have a similar problematic and any idea for me would be very appreciated.
Sorry for the wording, I am a Spanish speaker. Thank you.
Without having checked the example, handing multiple days shouldn't be complicated. It all depends on how you model your time variable.
For example, you could:
model the time stamps as a long value denoted as seconds since epoch. This is how most of the examples are model if I remember correctly. Note that this is not very human-readable, but is the fastest to compute with
you could use a time data type, e.g. LocalTime, this is a human-readable time format but will work in the 24-hour range and will be slower than using a primitive data type
you could use a date time data tpe, e.g LocalDateTime, this is also human-readable and will work in any time range and will also be slower than using a primitive data type.
I would strongly encourage to not simply map the current day or current hour to a zero value and start counting from there. So, in your example you denote the times as [32:00-34:00]. This makes it appear as you are using the current day midnight as the 0th hour and start counting from there. While you can do this it will affect debugging and maintainability of your code. That is just my general advice, you don't have to follow it.
What I would advise is to have your own domain models and map them to Optaplanner models where you use a long value for any time stamp that is denoted as seconds since epoch.
Let's assume a variation on Nurse Rostering example in which instead of assigning a nurse to a shift on a day, the nurse is assigned to a variable number of timeblocks on that day (which consists of 24 timeblocks). eg: Nurse1 is assigned to timeblocks [8,9,10,11,12,13,14]. Let's call these consecutive assignments a ShiftPeriod. There is a hard minimum and maximum on these shiftperiods. However, optaplanner has difficulties finding a feasible solution.
When having hard consecutive constraints, is it better to model the planning entity as a startTimeBlock with a duration instead of my current way with assignment to a timeblock and a day and then imposing min/max consecutive?
Take a look at the meeting scheduling example on github master for 6.4.0.Beta1 (but the example will work perfectly with 6.3.0.Final too). Video and docs coming soon. That example uses the design pattern TimeGrains, which is what you're looking for I think.
Trying to generate the Roster of employees however going doing at the level of hour. Resource hour requirements are like 1h at 8, 2 at 9, 7 at 1pm..
After assigning the first 3 resources, it keeps checking solutions are around them via assigning/reassigning them to Slots without trying to assign other employees.
How to troubleshoot this problem? couldn't it be the weights for each constraint/violation? Does it speed it if I implement a quick construction heuristic that fills the slots before handing to local search?
Current configuration consists of first_fit for construction heuristic, hill climbing as first phase till it get stuck then tabu with simulated annealing
Normally a CH assigns all employees before LS starts, which just moves them around but never unassigns anyone. See general phase sequence diagram in chapter "optimization algorithms" in the docs. That's presuming you don't apply overconstrained planning (nullable=true or null in the value range).
If you do apply overconstrained planning, that you need to make sure that the score cost of leaving an employee unassigned is worse than the score cost of however he's could be assigned.
Also set up a benchmarker config, so you have some benchmark report graphs to allow you to understand what's going on.
I am searching for algorithm and jsprit or optaplanner project seems to be in order to resolve my problem. We only work with Java.
I have take a look at jsprit bicycle example, an entry point, and now I need to solve a problem arround patient transportation.
A stretcher can carry a bed, a wheelchair or a valid patient. He can carry a wheelchair and a valid at the same time if they go to the same area and come from a same area.
for long distance, a bed require 2 stretchers
a bed mover (a kind of electric truck fixed to the bed) replace 1
stretcher
bed movers are most efficient for long distance but may be use for
short too
a bed mover only helps for bed (nor for wheelchair nor valid patient)
when finish, the bed mover stays in place or returns empty to a park
area (maybe 1..n places)
General rules :
the total time of transportation per agent must be as equals as
possible as each others (equity)
transports are time windowed and delay must be as short as possible
(depending on priorities)
new transport requests comes every time
it's better to use bed movers than 2 stretchers
Can you give me how to start to resolve this kind of problem. Do you think it's possible?
Regards
Starting with the customary - "please excuse me as this is my first post and i'm a relative beginner" disclaimer, i have the following question...
I work for a not for profit campaigning organisation, I've set up an SSAS solution to measure campaigning actions (e.g emailing the priminister) taken by a set on campaigners (customers) the main fact table has a count of actions as its measure, and is sliceable by say time and geography....
... but I also want to have another factless fact table that can show a count of how many campaigners are in what mailing segment... so i think what i need to do is basically dump a copy of my campaigner dimesion (which is slowly changing for people moving geography etc) into its own factless fact table... columns being FK_campaigner, segment_id, start_date, end_date but then how do i link that into the time dimension as it doesn't have an FK_time (merely a start and end time)... i guess what i want to do is relate the factless table to the time table on a "when PK_time > start_date and < end_date" then slice for me... but HOW? and is this possible or do i have to go down the route of loading one fact for each day that someone was in a segment?
many thanks to anybody who can point me in the right direction either structurally (is the broad approach wrong?) or even better in the practicalities of actually doing it in SSAS..
AJ
If you just want to analyse this data for a single point in time e.g. show me what what my numbers looked like at point x. Then you could have the time dimension be the "effective date" .
This would be semi additive and you would not be able to aggregate the data across time.
However, if what you interested in is analyzing the transition between time periods, than there is a "Many to Many" solution that would allow this:
Many to Many revolution white paper
The whitepaper provides several models the one that would be relevant in your scenario would be either the "Cross Time" or "Transition Matrix"
Good luck