Loading [MathJax]/jax/output/CommonHTML/jax.js

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.8xx1.2x effectively says: x0.

I think the poster means 0.8x0x1.2x0 where x0 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: pi,j=ui,jai,jyjjui,jai,jyjiI,jJ 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.

References


  1. How to define variables, constrains to Pandas Dataframe when using CVXPY for optimization?, https://stackoverflow.com/questions/54336137/how-to-define-variables-constrains-to-pandas-dataframe-when-using-cvxpy-for-opt
  2. How to use large data sets with non-linear optimization solvers in python?, https://stackoverflow.com/questions/54293666/how-to-use-large-data-sets-with-non-linear-optimization-solvers-in-python


No comments:

Post a Comment