New answers tagged constraint
2
votes
Accepted
MIP formulation for a lower semi-continuous function
You want to maximize $\max(f(x),0)$. Assume $L \le f(x) \le U$ for constants $L$ and $U$. Maximize $g(x)$ subject to
$$
0 \le g(x) \le U y \\
0 \le g(x) - f(x) \le (0-L)(1-y) \\
y \in \{0,1\}
$$
2
votes
What is the best way to constrain a binary matrix so that at most one row has positive values?
Adding to the solution provided by @EhsanK. By introducing a binary variable $z$, which is 1 only if all $x_{i,j}$ are equal to 0, and adding a constraint, potential symmetries in the branch-and-bound ...
0
votes
Sum only over weekend days
I would just define another set, $T^{Weekends} = \{t \in T | t\mod 7 =6 \;\vee t \mod 7=0\}$. Here I have assumed that you have a set $T$ with all relevant days.
Then you can write your constraint ...
0
votes
Starting with HiGHS
With version 1.5.3 you should add constraints using the addRow(...) method in the format lhs <= constraint <= rhs
...
4
votes
What is the best way to constrain a binary matrix so that at most one row has positive values?
Introduce a binary variable $y_{i}$ and then define these constraints:
$x_{i,j} \le y_{i} \quad \forall i, j \tag{1}$
$\sum_{i} y_i \le 1 \tag{2}$
So, at most one of the $y_i$ can be 1 and in that ...
1
vote
How to identify constraints that are good candidates for being lazy constraints?
Good candidates for lazy constraints are constraints which are not active in the optimal solutions of the relaxations. Thus, removing them speeds up the relaxation.
For lazy constraints to be useful, ...
1
vote
Accepted
Compute time between tasks
What you could do is the following: Introduce variable $t_{ij}$ that is the time between tasks $i$ and $j$. This variable is only defined for once per pair $ij$, therefore the $j >i$. Then, you can ...
2
votes
Constrained optimization of a sum
The problem
$$
\begin{array}{rcl}
\min & \sum_{j=1}^n c_j x_j & \\
\mbox{st} & \sum_{j=1}^n x_j & = & b, \\
& l \leq x \leq u. & & \\
\end{array}
$$
can ...
1
vote
Constrained optimization of a sum
Primal Problem
$$\begin{align}
\text{maximize} \quad & \sum_{i=1}^n c_i x_i \\\
\text{subject to} \quad & \sum_{i=1}^n x_i = 0 \\
& x_i \ge -1 \quad \forall i=1,\ldots,n \\
& x_i \le ...
Top 50 recent answers are included
Related Tags
constraint × 248modeling × 68
optimization × 67
mixed-integer-programming × 58
linear-programming × 58
integer-programming × 30
binary-variable × 27
logical-constraints × 26
pyomo × 22
python × 21
linearization × 21
constraint-programming × 20
convex-optimization × 15
scheduling × 13
gurobi × 12
nonlinear-programming × 12
indicator-constraints × 9
cplex × 8
big-m × 8
solver × 7
combinatorial-optimization × 7
quadratic-programming × 7
convexity × 7
job-shop-scheduling × 5
or-tools × 4