Is a bound a constraint?
AnsweredLet \(T \subset \mathbb N\) denote time, and \(x : T \to \mathbb R\) a function (the variable). For some subset \(T_0 \subseteq T\), I require \(x(t) = 0\) for all \(t \in T_0\). I was wondering if the following is equivalent:
# Variant 1
for t in T_0:
x[t].LB = 0
x[t].UB = 0
# Variant 2
model.addConstrs(x[t] == 0 for t in T_0)
And, is one variant preferred to the other from a compuational point of view?
-
Both variants will fix the corresponding variables to \(0\) in the presolve step. Thus, it should not matter which variant you use. However, if you observe any significant differences in the optimization behavior between the two variants, could you please let us know?
Best regards,
Jaromił0 -
Dear Jaromił,
I was assuming that it does not matter. To provide perspective: I was wondering whether tolerance \(\varepsilon\) is one-sided w.r.t. bounds in the sense that Variant 1 is satiesfied if \(x(t) \in [0, 0+\varepsilon] \cap [0-\varepsilon, 0] = [0]\) and Variant 2 if \(x(t) \in [0-\varepsilon, 0+\varepsilon]\). That is, Variant 1 is stricter than Variant 2. I guess, however, that tolerance is always two-sided even if it means to break through bounds.
Best,
Simon0 -
Dear Simon,
In this particular case, tolerances don't matter, because the variable will be replaced by value \(0\). Thus, the optimizer won't have any chance to exploit tolerances because the variable becomes a constant.
If this would not be the case, then your thinking makes sense. However, it strongly depends on the actual implementation. For bounds, one could still allow for an \(\epsilon\) tolerance violation in the opposite direction resulting in the same interval as for variant 2. For your first variant the \(\cap\) could be a \(\cup\), because if, e.g., \(x=\epsilon\) then \(x\) satisfies its lower bound and it satisfies its upper bound up to the given tolerance \(\epsilon\).
Best regards,
Jaromił0
Please sign in to leave a comment.
Comments
3 comments