I want to ensure, that a generator (in my case a heat generator, for example a boiler) first starts to output thermal energy, when a certain minimum output can be realized. Otherwise the output should be zero. For example, the boiler should not run if it can only output 1mW, first if it can output at least 1kW or so.

So what I actually want to do, is make the the value of a variable dependent on its own value. Basically:

IF $x\geq x_\text{min}$: $x=x$

ELSE: $x=0$

To show what I mean, here is a broken down version of my problem formulation:


$\mathcal{T}$ for timesteps


$d_t\quad\forall t\in\mathcal{T}$ for thermal demand at timestep $t$

$\eta$ for boiler efficiency

$h_\text{min}$ for minimum possible boiler heat output


$g_t\quad\forall t\in\mathcal{T}$ for gas fed to boiler at timestep $t$

$h_t\quad\forall t\in\mathcal{T}$ for heat from boiler at timestep $t$

$r_t\quad\forall t\in\mathcal{T}$ for deciding whether the boiler is running at timestep $t$ (binary variable)


Minimize difference between thermal demand and supply by boiler (I think enforcing equality via constraint would lead to infeasibility, if the boiler can only run with a certain minimum output). $$\text{min.}\quad\sum_{t\in\mathcal{T}}d_t-h_t$$


Balance input/output of boiler: $$h_t=\eta\cdot g_t\quad\forall t\in\mathcal{T}$$

And my approach to enforce minimum output (which does not work for $r_t=0$): $$h_t\geq r_t\cdot h_\text{min}\quad\forall t\in\mathcal{T}$$

I have seen Solutions like here or here. However, I think these solutions are not applicable here, since there is one variable dependent on the value of another variable. But here I really want to say: "If the output $x$ is greater than for example 1 kW, say 2kW, than $x=2$kW, but otherwise $x=0$kW"

Is there a possibility to achieve this if-else like behaviour?


2 Answers 2


What you describe is the disjunction $$(x \geq x_\min) \mbox{ or } (x=0),$$

which can be input directly into any optimization software that supports disjunctive constraints. Alternatively, you need an upper bound on $x$, say $x_\max$, which leads to the Big-M formulation $$x_\min z \leq x \leq x_\max z,\; z \in \{0,1\}.$$

In your application, I guess $x_\max$ would be interpreted as the maximum possible thermal output from the boiler, and $z$ is whether thermal energy is being output from the boiler or not.


This is called a semi-continuous variable. Most MIP solvers support such a variable type directly.

  • $\begingroup$ ah thank you for the hint! $\endgroup$
    – Andre
    Feb 10, 2023 at 11:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.