Hot answers tagged

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$.


6

No, it is an intrinsically non-convex constraint. Just take a diagonal matrix, and the feasible set would be the coordinate axes, i.e. nonconvex and highly ill-conditioned as the feasible set has measure 0.


5

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 - ...


4

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 >= ...


4

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


4

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.


4

If you can't find (or can't afford) a solver that will handle a problem with that many nonzero matrix coefficients, and if your problem has a structure that fits one of the following methods, you might try either Dantzig-Wolfe or Benders decomposition.


3

Set boolean=True for the matrix variable P, and use the constraints you have proposed.


3

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 ...


2

For all $c>0$ the function of one variable $$g(x)=c^{x/L}\cdot L - \ln(c)\cdot x=\exp(\ln(c)x/L)\cdot L-\ln(c)\cdot x$$ is convex increasing on $x\geq 0$ (derivative check) and DCP representable (verbatim). So we can model your extension to all real numbers via $$u\geq \max(x,0),$$ $$t\geq g(u).$$ Now if $x\geq 0$ then we have $t\geq g(x)$ and if $x\leq 0$...


2

After a few hours extra deliberation and and working on the problem, I was able to figure out the reason. It was as I thought initially and my calculation for my flow_in wasn't DCP and I am not entirely sure or understand why, but I will be definitely teaching myself this in the time going forward. I was able to adjust the calculation to look like the ...


1

If your costs are linear, there is no need to introduce binary variables or big-M constraints here. Define three sets of nonnegative decision variables: $I_t$ is the inventory at the end of period $t$ $P_t$ is the production in period $t$ $B_t$ is the unmet demand in period $t$ Let $d_t$ be the demand in period $t$. The inventory balance constraints are $$...


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