I am attempting to optimize the operation of an electrical system that produces some amount of thermal power $P_t$ and keeps a temperature $x_t$ within a certain range. Given a cost vector $\mathbf{c} \in \mathbb{R}^n$, bounds $P_{\max} > P_{\min} > 0$ and a time horizon ${\Bbb T} \in {\Bbb Z}$, I have the following mixed-integer linear program (MILP)
$$ \begin{array}{rl} \underset{\mathbf{P} \in \mathbb{R}^n, z_t \in \{0,1\}}{\text{minimize}} &\quad \mathbf{c}^\top \mathbf{P}\\ \text{subject to} & z_t P_{\min} \leq P_t \leq z_t P_{\max} \quad &\forall t \in {\Bbb T}\\ & x_{t+1} = A x_t + BP_t \quad &\forall t \in {\Bbb T}\\ & x_\min \leq x_t \leq x_\max \quad &\forall t \in {\Bbb T}\\ \end{array} $$
where the binary variable $z_t \in \{0,1\}$ indicates whether the machine is on or off at time $t$:
- when it is on, $P_t \in [P_{\min}, P_{\max}]$
- when it is off, $P_t = 0$
My time horizon $\Bbb T$ can have up to 96 time indices, so that would result in a combinatorial problem with $2^{96}$ options. Yet, Gurobi can solve this problem globally in milliseconds.
Real-time optimization
I can solve the MILP offline without any issues, but now it has to run iteratively on more constrained hardware. Unfortunately I cannot use an MILP solver on this hardware. The temperature dynamics are rather slow, so I don't have any strict timing constraints. But I would like to relax the binary constraint so I don't have to deal with the combinatorial part.
I assumed this kind of situation would turn up in practice all the time, but I have yet to find a good solution. Of course, I could just relax the binary variable to $z_t \in [0,1]$ but wouldn't that produce infeasible solutions $0 < P < P_\min$?
Unfortunately I cannot use an MILP solver on this hardware.Would you elaborate more on how you can solve the problem as an LP, relaxed form, but cannot deal with BIP? $\endgroup$solve()function + some functions to set new parameters values. That's exactly what I want, but it can't solve MILPs (yet). And maybe it never will, but I am confident I can find a way to solve this using just the LP solver + some reformulations or heuristics or post processing or whatever is needed. Solving it in the model formulation would be by far the most elegant ofcourse! $\endgroup$