Saturday, January 26, 2019

Strange math

Some examples that caught my eye.

Strange constraints

In [1] we see a strange constraint:

A constraint like \[0.8 x \le x \le 1.2 x\] effectively says: \(x\ge 0\).

I think the poster means \[0.8 x^0 \le x \le 1.2 x^0\] where \(x^0\) are the original levels. In GAMS you can write this as:

  e1.. x =l= 1.2*x.l;
  e2.. x =g= 0.8*x.l;

or better

  x.lo = 0.8*x.l;
  x.up = 1.2*x.l;

New LP modelers often have problems considering the constraints as simultaneous equations. Many times I see they think about some ordering.

Valid math?

In [2] we see a constraint like: \[p_{i,j}= \frac{u_{i,j} a_{i,j} y_j}{\sum_j u_{i,j} a_{i,j} y_j}\>\> \forall i \in I, j \in J\] Looks like some kind of normalization. I am not sure this is valid math: we have two different \(j\)'s. Probably we should apply some scoping rules when reading this. In GAMS we would see:

   4  eq(i,j).. p(i,j) =e= (u(i,j)*a(i,j)*y(j))/sum(j,u(i,j)*a(i,j)*y(j));
****                                                 $125
**** 125  Set is under control already

I agree with this error.


  1. How to define variables, constrains to Pandas Dataframe when using CVXPY for optimization?,
  2. How to use large data sets with non-linear optimization solvers in python?,

No comments:

Post a Comment