What kind of problem is this? Is feasible with optaplanner? - optaplanner

I have to solve a problem on a manufacturing environment where:
A number of processes with subtasks needs to be scheduled.
Each subtask need N resources that can be, raw material, workers or machines.
Some subtasks need a worker with certain skills or from a department.
Workers are organized in shifts, so it may happen that on a shift certain skill may not be available. *
A machine can fit N pieces, depending on the piece size and the capacity of the machine. *
A machine may accept pieces of different types. *
Machines can be not available on a period as maintenances can happen.
If the next piece going to the machine is different from the previous one, a new task for maintenance needs to be inserted. *
If there is no raw material of certain category it can be manufactured, so a new process to manufacture that raw material needs to be inserted before the one that needs it. *
The processes can have a deadline.
Some raw materials can be partially consumed, so for example if we have 2L of painting, a subtask require 1L of that painting.
Is this a Job Shop or any variant problem? Is it possible to do with optaplanner? Are there too many constraints for the solver?
I know that the tasks scheduling and the requirements of each subtasks can be done, my biggest concern is with the ones that I have marked with *
Thank you in advance.

In the OptaPlanner docs, look for the Design Patterns chapter and read the section on how to design a good model and also the section on assigning to time (timeslot vs time grain vs chained).
These are 2 related video's:
https://www.youtube.com/watch?v=0uAoWU8m0pE
https://www.youtube.com/watch?v=Ew6pq9nJKog

Related

How to design the models in OptaPlanner in my case

I have been started to learn Opataplanner for sometime, I try to figure out a model design for my use case to progress the solution calculation, here is my case in real world in manufactory's production line:
There is a working order involved list of sequential processes
Each kind of machine can handle fixed types of processes.(assume machine quantity are enough)
The involved team has a number of available employees, each employee has the skills for set of processes with their different own working cost time
production line has fixed number of stations available
each station put one machine/employee or leave empty
question: how to design the model to calculate the maximum output of completion product in one day.
confusion: in the case, the single station will have one employee and one machined populated, and specified dynamic processed to be working on. but the input of factors are referred by each other and dynamic: employee => processes skill , process skill => machines
can please help to guide how to design the models?
Maybe some of the examples are close to your requirements. See their docs here. Specifically the task assignment, cheap time scheduling or project job scheduling examples.
Otherwise, follow the domain modeling guidelines.

Optaplanner - How to model a timeslot pattern scheduling problem if certain type of tasks require less resource when they're scheduled in same slot?

I'm developing a daily timeslot pattern scheduling problem with task precedence and daily shifts resource constaint.
Each product has several batches and each batch consists of sequential tasks (like prepare\mix\process etc.) to be scheduled.
Tasks consume shift units and there are daily shift limits for each type of tasks.
If two prepare tasks of same product are schedued on the same day, they consume 1 units of shift together, while each of them still use 1 shift unit if they are scheduled apart.
Succeeding tasks (like mix or process) of same products won't benefit from scheduling together on the same day. If one mix task use 1 shift unit, then two mix tasks scheduled on the same day would consume 2 shift unit in total.
This senario differs from project job scheduling problem, where task durations variation depend on machines, not other tasks.
I've implemented a simple model without changeable resource requirement and it works. I came up with a dummy idea: manually combine each two prepare tasks together and consider it as one task. But this would make the model less versatile and harder to write drool rules.
Any hint or help is appreciated. Thanks.
I solved this by using a shadow variable "modifiedProcessTime" in planning entity and updated by a Custom VariableListener when two or more tasks from same product same type are scheduled on the same day. The first task remains its original processing time, while other task are set to be zero.

Is it possible to treat tasks with controllable processing time?

I am wondering if it's possible to treat scheduling problems with tasks with the following property using Optaplanner. Instead of have a fixed duration of 1 hour we have a 1 hour-man, i.e if there is two employees working on that task, it could be done in 1/2 hour.
Otherwise, what are the other solvers that could be used ?
Model wise, the easy approach is to split up that 1 task into 2 smaller tasks that get individually assigned. (When they're both assigned to the same person, sequentially after each other, you can add a soft constraint to reward that.) The downside is that you have to decide in advance for each task into how many pieces they can be split up.
In reality, tasks are rarely arbitrary dividable. Some parts of each task are atomic. For example, taking out the garbage can is a do-or-do-not task. Taking it half the way out, or taking half of it out, and assigning someone else to do the rest, is not allowed because it will increase the time spent on it.
Some tasks need at least 2 persons to execution. For example, someone to hold the ladder while the other is standing on it. In the docs, see the auto delay to last pattern.
Alternatively to the simple model, you can also play with nullable=true and custom moves to allow multiple people to assign to the same tasks, but it's complicated. It can avoid having to tune the number of task pieces in advance too much. Once we support #PlanningVariableCollection, and do so fully, more and better options in this regard will become available.

Optaplanner VRP example, multiple vehicles required per stop in same time window

We are using a customized VRP tutorial example to optimize daily routes for service engineers who travel to customers in order to execute certain repair and installation tasks. We do have time windows and we optimize 1000+ tasks for multiple weeks into the future.
Our (simplified) domain model consists of:
Engineer - the guy doing all the work
Task - a single work assignmet at a certain location
DailyRoute - an Engineer's route for given day, consists of a linked list of Tasks
As a new requirement we must now support two engineers working in parallel on the same task.
Our current plan is to implement this by creating subtasks for the second engineer and implement a rule that their arrival time must be identical to the main task.
However, this is problematic since moving one of the interdependant tasks to a different time (e.g. a different DailyRoute) will mostly violate the above constraint.
So far, we have come up with the following ideas:
Allow single task moves only to a DailyRoute on the same day as the other task's assigned route
can be done via a SelectionFilter
Use CompositeMoves to move both of the parallel tasks at once to different days
Do we need a custom MoveIteratorFactory to select the connected tasks?
Or can this be done with a CartesianProductMoveSelector instead?
Can we use nearby selection for the second move to prefer the same day as the first move's newly assigned day (is move one already done at that time)?
For two engineers working in parallel on the same task, see docs "design patterns" specifically "the delay till last pattern". There is no example, but our support services have helped implemented it a few times - it works.
For the multiple stops at the same location: I've seen users split such visits up into smaller pieces to allow optaplanner to choose which of those pieces to aggregate. It works but it's not perfect: the more fine-grained the pieces, the much bigger the search space - the more that adding a custom move that focusses on moving all pieces together might help (but I won't start out with it). Generally speaking: if the smallest vehicle has a capacity of 100, I 'd run some experiments with splitting up to half that capacity - and they try a quarter too, just to see what works best through benchmarking with optaplanner-benchmark.

Scheduling a Job that consumes multiple resources

I've got a problem which I think optaplanner may be able to solve, but I haven't seen a demo that quite fits what I'm looking to do. My problem set is scheduling IoT node usage for a testbed. Each test execution (job) requires different sets of constraints on the nodes it will use. For example, a job may ask for M nodes with resource A, and N nodes with resource B. It will also specify a length of time it needs the nodes for and a window in which the job start is acceptable. To successfully schedule a job, it must be able to claim enough resources to meet the job specific requirements (ie, hard limits).
Being new to optaplanner, my understanding is that most of the examples focus on only needing one resource per Job. Any insight into whether this problem could be solved with optaplanner and where to start would be highly appreciated.
If you haven't already, look at the (cheap time scheduling example](https://www.youtube.com/watch?v=r6KsveB6v-g&list=PLJY69IMbAdq0uKPnjtWXZ2x7KE1eWg3ns) and project job scheduling example.
The differentiating question is if when job J1 needs M nodes with resource A if whether or not any of those M nodes can also supply resource B, just not at the same time.
If that's not the case, this is an easy model: you can threat resource A as a capacity like cloud balancing.
If that is the case, it's a complex model (but still possible), for example the jobs are chained or time grained (=> planning var 1) and each job has tasks which are assigned to nodes (=> planning var 2). All of this is likely to need custom moves for efficiency.