I am trying to maximise machine profit subject to a repair plan (job schedule), but cannot seem to map between the integer domain from the job schedule to the binary domain for the revenue model in order to constrain the model correctly.
As a concrete example, imagine a CNC machine that generates a known but variable profit at a given time $t$, but must be turned off (not generating any profit) to be repaired. We want to maximise profit, subject to the repair schedule (all activities must be performed).
I simply have:
$max(P_t * A_t)$
where $A_t = \begin{cases} 1, & \text{if machine is online at period $t$} \\ 0, & \text{otherwise} \end{cases}$
is a binary decision variable, $P_t$ it the profit for running at time $t$ (where $t \in T (0,1,2...N)$), $N$ is the number of periods we're optimising for.
We furthermore have a set of activities $X$, namely (${Grease, Realign, Test}$) with a duration:
$D = \{Grease = 1, Realign = 2, Test = 3\}$
Which must be completed before they are due:
$X_i + D_i \leq Due_i$
where $X_i$ is the integer decision variable of when to undertake activity $i \in X$, $D_i$ is the duration of activity $i$ and $Due_i$ is the due date of activity $i$.
Activities cannot overlap, that is (as per Linear Programming - Preventing Staff Scheduling Shift Overlap?):
${\forall {i \neq j} \in X}:$
$S_i \geq E_j - M\delta_{i,j}$
$S_j \geq E_i - M(1-\delta_{i,j})$
$\delta_{i,j} \in \{0,1\}$
Where $S_j$ represents the start of activity $j$ and $E_i$ represents the end of activity $i$, $\forall \{i,j\} \in X$, where $M$ is suitably large ("Big-M") and $\delta$ is a binary indicator variable.
The problem I face is that I now wish to add a constraint that states $A_t == 0$ if any activity is performed at time $t$.
I have approached this by creating a double bound binary indicator variable as per Question to the solution of "Indicator Variable if x is in specific range" hoping to create a variable which represents:
$W_{x,t} = \begin{cases} 1, & \text{if activity $x$ is active at time $i$} \\ 0, & \text{otherwise} \end{cases}$
from which I can then sum the total active jobs at time period $t$:
$totalActive_{t} = \Sigma_{i \in X} W_{i,t}$
and then derive an additional binary indicator representing "any job is active" at a time period $t$ using the previously mentioned binary decision indicator variable to create:
$AnyActive_t = \begin{cases} 1, & \text{$totalActive_t \geq 1$} \\ 0, & \text{otherwise} \end{cases}$
I was hoping to then simply be able to use binary decision logic, such as
$A_{t} + AnyActive_{t} \leq 1$
In order to allow the machine to be running, or to allow repair jobs to be undertaken, but this does not seem to work in practice.
Am I missing something?
For some practical values for $P_t$, let us assume:
$$\begin{array}{c|c} \text{Time Index} & \text{Profit} \\ \hline \text{1} & 1.8 \\ \hline \text{2} & 6.5 \\ \hline \text{3} & -5.3 \\ \hline \text{4} & 3.2 \\ \hline \text{5} & 5.6 \\ \hline \text{6} & -4.1 \\ \hline \text{7} & -7.8 \\ \hline \text{8} & 0.1 \\ \hline \text{9} & -6.8 \\ \hline \text{10} & 7.5 \\ \hline \text{11} & -4.7 \\ \hline \text{12} & -4.3 \\ \hline \text{13} & 1.9 \\ \hline \text{14} & 4.4 \\ \hline \text{15} & 2.6 \\ \hline \text{16} & -0.8 \\ \hline \text{17} & -1.8 \\ \hline \text{18} & -7.1 \\ \hline \text{19} & -3.1 \\ \hline \text{20} & -9.0 \\ \hline \text{21} & -3.3 \\ \hline \text{22} & -6.4 \\ \hline \text{23} & 2.9 \\ \hline \text{24} & 1.3 \\ \hline \end{array}$$
and all activities are due prior to period 24.
Any help would be much appreciated!