optapy / optapy-quickstarts

OptaPy quick starts for AI optimization: showcases many different use cases.
Apache License 2.0
19 stars 13 forks source link

Planning List Variable Constraint #14

Closed keremtatlici closed 1 year ago

keremtatlici commented 1 year ago

We are try to use EmployeeSchedule algorithm for n-n shift-employee schedule. But the algorithm assigns only one employee per shift. For this case we find that we need to use planning_variable_list decorator (as shown as in the vehicle algorihm) and with this decorator we update our domain class. But our constraints are not working after we do this updates and we couldn't find any example to use constraints like situation that we are in.

If you may tell us that in the EmployeeSchedule how to do that we can manage to make it in our project

Christopher-Chianelli commented 1 year ago

I expect @planning_list_variable will not do what you expect; @planning_list_variable is primarily used to replace chained models, and corresponding have these properties:

Is the number of Employees per Shift known in advance? If so, you can solve this issue by creating N different Shift instances if a shift requires N employees.