I'm working on a tool to generate a timetable for employee up to a month taking into account commercial and labor law constraints. Few challenges and difference from similar problem:

- The shift concept contains breaks split up to half an hour.
- There is no concept of full 8 shifts as the referred similar problem. e.g. There is a need to have 2 resources at 8am, 2.5 resources at 3PM (e.g. give half hour break)..
- and regular constraints like hours per day, hours before break, break time...

Possible solutions is to rely on using a solver aka OR-Tools and Optaplanner. any hints?

Answer:

If you go with OptaPlanner and don't want to follow the Employee Rostering design of assigning 8 hours Shifts (planning entities) to Employees (planning value), because of your 2th constraint, then you could try to follow the Cheap Time Example design, something like this:

```
@PlanningEntity public class WorkAssignment {
Employee employee;
@PlanningVariable PotentialShiftStartTime startTime
@PlanningVariable int durationInHalfHours
}
```

PotentialShiftStartTime is basically any time a shift can validly start, so Mon 8:00, Mon 8:30, Mon 9:00, etc.

The search space will be huge, in this free form way, but there are tricks to improve scalability (Nearby Selection, pick early for CH, Limited Selection for CH, ...).

To get out of the free form way (= to reduce the search space), you might be able to combine startTime and durationInHalfHours into PotentialShift, if for example it's not possible to start a 8 hour shift at 16:00 in the afternoon. But make sure the gain is huge before introducing that complexity.

In any case, the trouble with this design is determining how many WorkAssignment instances to create. So you'll probably want to create the max number possible per employee and work with `nullable=true`

to ignore unused assignments.

solver,isabelle,theorem-proving

In Isabelle, I often find that I can prove a goal successfully using different solvers. Generally I would prefer to use the weakest solver that can just about prove the goal. Based on my experience with Isabelle so far, my current understanding is that in order of increasing strength and...

c++,algorithm,math,data-structures,discrete-mathematics

a) with sequence X=(x1,x2,...,xn) of positive real numbers, we can find a sub-sequence that elements in this sub-sequence has a maximum product in O(n). b) with an algorithm of order O(n) we can merge m=sqrt(n) sorted sequences that in whole we have n elements. why my professor say these two...

r,optimization,solver,maximize,lpsolve

I am new to R and have a particular fantasy sports team optimization problem I would like to solve. I have seen other posts use lpSolve for similar problems but I can not seem to wrap my head around the code. Example data table below. Every player is on a...

database,algorithm,math,sharding,discrete-mathematics

Scenario Let's say you have multiple databases in 3 zones. Zone A, B, and C. Each zone in different geographical location. At the same time, you have an application that will route username and password based on the geographical location of the user. For example, user A will be redirected...

excel,vba,excel-vba,random,solver

I have a monte carlo simulation model and I need to set one of my parameters (service level) to be at least 95%. The problem is that, from what I know, when Solver runs, it tries different solutions, but because of RAND() function, the target cells keeps on changing all...

matlab,simulink,solver,ode,differential-equations

I need to solve this ODE using Simulink and I don't know how to make it. I only know how to do it using ODE solvers. y'' - y' - 2y = e^(3x) y(0)=1, y'(0)=2. I rewrote the equation obtaining an ODEs: y' = f(x,y) y(x0) = y0 y'1 =...

string,algorithm,probability,combinatorics,discrete-mathematics

Disclaimer: This is a problem lifted from HackerRank, but their editorial answer wasn't sufficient so I hoped to get better answers. If it's against any policy, please let me know and I'll take this down. Problem: You are given two integers, N and M. Count the number of strings of...

python,algorithm,math,sequence,discrete-mathematics

NOTE: This is for a homework assignment, but the portion I have a question on is ok to ask help for. I have to script out a sequence 11110000111000110010 (i am using python) without using switches or if statements and only a maximum of 5 for and whiles. I already...

algorithm,math,discrete-mathematics,nearest-neighbor

The gotcha with this question is "arbitrary metric". If you don't know what that is, it's just the way to measure distance between points. (In the "real" world, the 1-dimensinal distance is just the absolute magnitude of the difference between the two points). Enough of the pre-lims. I'm trying to...

r,excel,function,solver

I have a question concerning the possibility to solve functions in R, and doing the same using excel. However I want to do it with R to show that R is better for my colleagues :) Here is the equation: f0<-1e-9 t_pw<-30e-9 a<-30.7397582453682 c<-6.60935546184612 P<-1-exp((-t_pw)*f0*exp(-a*(1-b/c)^2)) I want to find the...

discrete-mathematics,solver,simulated-annealing,rostering,tabu-search

I'm working on a tool to generate a timetable for employee up to a month taking into account commercial and labor law constraints. Few challenges and difference from similar problem: The shift concept contains breaks split up to half an hour. There is no concept of full 8 shifts as...

c#,math,solver

I would like to know if there is any function in Math.Net in C# having the same function as pcg in Matlab which is able to handle the A(x) = b, rather than Ax = b. Here, A(x) means A is a function of x, rather than A times x...

algorithm,discrete-mathematics

I'm doing an online course and i'm stuck on this question. I know there are similar questions but they don't help me. What is the order of growth of the worst case running time of the following code fragment as a function of N? int sum = 0; for (int...

math,sequence,discrete-mathematics,cyclic

I came across this sequence in a programming contest F(n)= F(n-1)-F(n-2); Given F0 and F1 find nth term (http://codeforces.com/contest/450/problem/B) (the contest is over) Now the solution of this problem is like this The sequence take value f0, f1, f1-f0, -f0, -f1, f0 - f1 then again f0 and the whole...

python,numpy,scipy,solver

Say I have the following code def myfunc(x): return monsterMathExpressionOf(x) and I would like to find numerically the solution of myfunc(x) == y for diverse values of y. If y == 0 then there are a lot of root finding procedures available, e.g. from scipy. However, if I'd like to...

c++,cuda,linear-algebra,solver,cusolver

We are experiencing problems while using cuSOLVER's cusolverSpScsrlsvchol function, probably due to misunderstanding of the cuSOLVER library... Motivation: we are solving the Poisson equation -divgrad x = b on a rectangular grid. In 2 dimensions with a 5-stencil (1, 1, -4, 1, 1), the Laplacian on the grid provides a...

python,numpy,sympy,solver

I am making a syntax error, some how my syntax is leading python to think I am writing +.log some where? Please take a look at the code and let me know. Can any one suggest, a function that can be used instead to solve this Algorithm import numpy as...

solver,sage,maxima

I am trying to solve equation sqrt(x)==sqrt(20*(1500-x)) in sage and getting the output as given bellow, sqrt(x) == sqrt(-20*x + 30000) Problem in the above solution is that there is x in both side. How can I solve this kind of question sot that I get proper solution. I have...

algorithm,math,graph,discrete-mathematics

Suppose G be a planar graph with 16 vertex, that degree of each vertex is 4. When we place this graph on plane as a planar graph, each finite region be a trilateral or foursquare and boundary of infinite region is made up by 4 edges. How many trilateral edge...

f#,mapping,intervals,discrete-mathematics

Suppose we have a pair of input arrays, or a list of (key, value) tuples if you prefer. What's an elegant and performant way to combine values that have indices falling in a certain interval? For example, if the interval (or 'bin') size is 10 then the values of all...

matlab,wolfram-mathematica,solver

I do just about everything in Matlab but I have yet to work out a good way to replicate Mathematica's FindInstance function in Matlab. As an example, with Mathematica, I can enter: FindInstance[x + y == 1 && x > 0 && y > 0, {x, y}] And it will...

solver,isabelle,theorem-proving

Every goal that I have encountered in Isabelle so far that could be solved using arith could also be solved by presburger and vice versa, for example lemma "odd (n::nat) ⟹ Suc (2 * (n div 2)) = n" by presburger (* or arith *) What's the difference between the...

matlab,signals,solver,ode,square

I'm trying to generate a square signal from inside a function, run through an ODE15s solver. The problem is, that the output is not square, but rather linear. function dX = test(t ,X ) y = X (1) ; a = 24; dc = 50; k = 2; f=k*2*pi; y=a*square(f*t,dc);...

java,solution,solver

I am using the Newton Raphson's method in order to find the root of an evaluation function in Java. I am using a while loop with the following termination condition : while(Math.abs(eval_x / deriv_x) > epsilon) Obviously it may create an infinite loop if the difference is bigger than epsilon....

python,recursion,probability,solver

def get_dir(state, max_depth): #Possible directions and their corresponding scores so far paths = {'w':1,'a':1,'s':1,'d':1} #Rate each direction for dir in paths: #Takes a game state and a direction as input and returns #a list of all possible states that could occur from moving in that direction children = successors(state, dir)...