# Tag Info

## Hot answers tagged cvxpy

7

What you described is a problem for which every variable is semicontinuous. In mixed integer programming, the variables are $(x,y)\in\mathbb{Z}^{n_1} \times \mathbb{R}^{n_2}$. For (pure) integer programming, take $n_2=0$.

3

I assume that $w_i$ is a continuous variable with $0 \le w_i \le 1$ and $w_i^\text{start}$ is a constant with $0 \le w_i^\text{start} \le 1$. You want to enforce $$|w_i-w_i^\text{start}| > 0 \implies |w_i-w_i^\text{start}| \ge 0.02.$$ You can introduce binary variables $y_i^+$ and $y_i^-$ and linear big-M constraints: \begin{align} 0.02 y_i^+ \le w_i - ...

3

As others have pointed out already, you are not solving the same instances. When writing out the MPS files using a gurobi.env file containing GURO_PAR_DUMP=1, we can see that the instances differ (here n=2, nIters=1; left is cvxpy, right is Gurobi): To get the signs in order, you could change this line in the Gurobi method model.addConstr(constrLHS >= ...

3

Note that the model fingerprint differs. I suspect that the variable or constraint orders are different.

2

CVXPY makes this easy to do, using its disciplined quasiconvex programming (DQCP) capability. An example is provided at https://www.cvxpy.org/examples/dqcp/concave_fractional_function.html . Fractional Linear programming, as you have, is a simple special case of this.

2

Formulation (7) on p. 6 of the linked paper is very explicitly linear in the matrix variable M and the newly introduced matrix variable V. MIDCP systems, such as CVXPY (CVX and others) allow programs which are DCP compliant but for binary or integer constraints. Formulation (7) falls into that category, and is just a "plain Jane" MILP; therefore is ...

Only top voted, non community-wiki answers of a minimum length are eligible