Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 487

For questions about mathematical optimization problems involving both continuous and binary or general integer variables.

5 votes
Accepted

How to reformulate a discontinuous piecewise-quadratic functions

Although focused on implementing the model in YALMIP instead of CVX (converting the code should be trivial), precisely this case is described in the following tutorial https://yalmip.github.io/modelli …
Johan Löfberg's user avatar
6 votes

Index of element in MILP vector decision variable that equals 1

My interpretation is that you want $y$ to be $i$ if $p_i=1$. You can do that with a simple multiplication $y=c^Tp$ where the constant vector $c$ is given by $c_i=i$.
Johan Löfberg's user avatar
5 votes

MILP modelling on minimal disturbance of right-hand-side to make a linear system infeasible

By Farkas lemma, infeasibility of $Ax\leq b$ is equivalent to feasibility of $A^Ty = 0, y^Tb < 0, y\geq 0$, or more practically useful $A^Ty=0, y^Tb \leq -1, y\geq 0$. Unfortunately, this will lead to …
Johan Löfberg's user avatar
6 votes
Accepted

Forbid transformation of max(x,y) into MILP

In YALMIP you can use arbitrary black-box operators to circumvent modelling n = 5; c = randn(3*n,1); A = randn(10*n,3*n); b = rand(10*n,1); % MILP model x = sdpvar(2*n,1); Domain= [0 <= x <= 1]; % Bi …
Johan Löfberg's user avatar
7 votes

Modeling floor function exactly

As all have mentioned, the problem is intrinsically hard, as it effectively involves a strict inequality. One way to represent it, using no strict inequalities or magic constants, is to use the simpl …
Johan Löfberg's user avatar
5 votes
Accepted

Why does one objective function prove feasibility faster than another?

Consider maximizing $\sum_{i=1}^n x_i$ subject to $x$ binary and $\sum_{i=1}^n i x_i \leq 2$ Solve relaxation and it gives $x_1 = 1, x_2 = 1/2$ with remaining variables 0. Branch on $x_2 = 0$ and the …
Johan Löfberg's user avatar
6 votes

Linearizing a quadratic function with more variables or not in Gurobi?

You can ask Gurobi to do this for you https://www.gurobi.com/documentation/9.1/refman/preqlinearize.html Whether a linearization leads to better or worse performance is almost impossible to know befor …
Johan Löfberg's user avatar
3 votes
Accepted

How to deal with log0 in optimization problem

You are not going to be able to add these logs and quadratic terms to the model via simple double-sided big-M constraints, as they generate non-convex use of convex quadratics and logs, and CVX does n …
Johan Löfberg's user avatar
3 votes
Accepted

How to transform this problem with logarithmic objective function into an approximated conve...

Introduce a term $y_m$ to replace and lower bound the terms inside the logarithm. Those lower bound constraints simplify to $\sum_{n=1}^{N}(1-x_{m,n})\omega_{m,n}+z\ge y_m(\sum_{n=1}^{N}x_{m,n}\omega_ …
Johan Löfberg's user avatar
5 votes
Accepted

Multiple If else constraints in Mixed integer programming

You just seem to have hidden a long list of constraints of the form $(x_i=j) \Rightarrow \text{equalities}_{ij}$ Introduce a binary matrix $C_{ij}$ with $\sum_j C_{ij}= 1$ and $C_{ij} \Rightarrow \{x …
Johan Löfberg's user avatar
5 votes
Accepted

Non-linear optimization local or global solution

Introduce a binary variable $\delta_t$ to represent which case it is and $z_t$ to represent the modelled product, and your MILP model of the piecewise-affine dynamics would be ${EP}_t\ =\ \sum_{i=1}^{ …
Johan Löfberg's user avatar