I have $N$ jobs and $M$ machines and want to minimize the makespan, i.e. the total time to finish all jobs. Some jobs have precedence constraints and can only be started once other jobs are finished. Not all machines can do all of the jobs. So far I have a working solution implemented in ortools
based on a problem formulation from this StackOverflow answer.
However I would like to modify the problem, and this is where it gets more tricky. Before, it was assumed that the time it takes a machine $m$ to do job $n$ is a fixed function $t(m,n)$. However, I would like to modify the problem such that the time it takes machine $m$ to do job $n$ is also a function of the previous job completed by machine $m$ (or a "dummy job" if the machine hasn't done any jobs yet). Something like: $t'(m, n, n_{prev})$
I am struggling to add this to the problem formulation. Any suggestions, or links to relevant papers, would be appreciated. I am envisioning a $t_{m}$ matrix for each machine $m$ where $t_{m,i,j}$ is the time for machine $m$ to complete job $j$ if the previous job it did was $i$.