New answers tagged

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\} $$
RobPratt's user avatar
  • 30.4k
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 ...
gmn's user avatar
  • 622
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 ...
gmn's user avatar
  • 622
0 votes

Starting with HiGHS

With version 1.5.3 you should add constraints using the addRow(...) method in the format lhs <= constraint <= rhs ...
Guilherme Coelho's user avatar
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 ...
EhsanK's user avatar
  • 5,864
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, ...
fontanf's user avatar
  • 2,495
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 ...
PeterD's user avatar
  • 1,461
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 ...
ErlingMOSEK's user avatar
  • 3,046
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 ...
marco tognoli's user avatar

Top 50 recent answers are included