Skip to main content

New answers tagged

5 votes

Set a limit on value change of a binary variable

The abs function is piecewise linear, so you can represent it with two linear inequalities as shown in https://docs.mosek.com/modeling-cookbook/linear.html#absolute-...
Henrik Alsing Friberg's user avatar
3 votes

Priority based demand fulfilment in Linear Constraint

You could model it as follows: Let $c_i$ the capacity of source $i$. Let $x_i$ the amount of demand source $i$ fills. Further, you can introduce variable $y_i$ that is binary and takes value 0 if $x_i ...
PeterD's user avatar
  • 1,636
1 vote

How to model this constraint in a better way?

Why don't you define the follwing variables $x_{ij}:=\{0,1\}$ if user i assigned to machine j to use these constraints, $\sum_j x_{ij}\geq 1$ for each user i at least one machine assigned to each ...
Majid Zohrehbandian's user avatar
4 votes
Accepted

How to model the constraints of min and max in cvxpy

Let constants $j_\min$ and $j_\max$ be the smallest and largest possible $j$ indices, respectively. Introduce binary decision variable $y_{ij}$ to indicate whether $x_{ij}>0$. Assuming $x_{ij}>...
RobPratt's user avatar
  • 32.3k
2 votes

Linear condition between two continuous variables

It is worth noting that the desired relationship can be expressed as $x=\max(y,0)$. You want to model a disjunction of two rays from the origin. Impose finite bounds \begin{align} 0 \le x \le U \tag1\...
RobPratt's user avatar
  • 32.3k
3 votes

Linear condition between two continuous variables

Let $L_x,U_x$ denote a lower and upper bound for $x$, and $L_y,U_y$ denote a lower and upper bound for $y$. Define an additional binary variable $\delta \in \{0,1\}$ and enforce the following: $$ y \...
Kuifje's user avatar
  • 13.5k

Top 50 recent answers are included