Yet Another Math Programming Consultant
by Erwin Kalvelagen
3d ago
I am teaching some GAMS classes, and a question came up: " How does the Simplex method work?" It's not easy to answer in a few sentences, but I want to touch upon the concept of a basis anyway. Once you have a good intuition of basis, a simple Simplex method is not so far-fetched. I find the tableaux presentation somewhat confusing and far removed from what actual Simplex solvers do. I prefer the Revised Simplex Method in matrix notation.  As a gimmick, I implemented a simplified version in the GAMS language. This reminds me that someone spent the effort writing a Basic interpr ..read more
Yet Another Math Programming Consultant
by Erwin Kalvelagen
1M ago
Presentation at USDA-ERS Model Summit 2024 ..read more
Yet Another Math Programming Consultant
by Erwin Kalvelagen
1M ago
Last friday, 6/28, new PCE (Personal Consumption Expenditures Price Index) data were released. The year-on-year numbers decreased from 2.7% last month to 2.6% indicating inflation (using this index) is decreasing from last month [1]:  Let's see how the popular press reports this [2]: The headline is just wrong. Inflation did not rise 2.6% in May. The price index (level) rose by 2.6%, but the inflation number (according to this measure) did actually decrease from 2.7% a month earlier. I see lots of mistakes in inflation reports. This is a good (or rather bad) example. References h ..read more
Yet Another Math Programming Consultant
by Erwin Kalvelagen
3M ago
The goal of this exercise is to fill a square area $$[0,250]\times[0,100]$$ with 25 circles. The model can choose the $$x$$ and $$y$$ coordinates of the center of each circle and the radius. So we have as variables $$\color{darkred}x_i$$, $$\color{darkred}y_i$$, and $$\color{darkred}r_i$$. The circles placed inside the area should not overlap. The objective is to maximize the total area covered.  A solution is: The optimization model can look like:  Non-convex Quadratic Model \begin{align} \max&\sum_i \color{darkblue}\pi\cdot\color{darkred}r_i^2 && && ..read more Yet Another Math Programming Consultant by Erwin Kalvelagen 3M ago Here is an example where the PuLP modeling tool goes bezerk. In standard linear programming, only $$\ge$$, $$=$$ and $$\le$$ constraints are supported. Some tools also allow $$\ne$$, which for MIP models needs to be reformulated into a disjunctive constraint. Here is an attempt to do this in PuLP [1]. PuLP does not support this operator in its constraints, so we would expect a meaningful error message. #------------------------------------------- # funny behavior when using a != constraint # in a PuLP model #------------------------------------------- import pulp model = pulp.LpPro ..read more Yet Another Math Programming Consultant by Erwin Kalvelagen 3M ago In [1], the question was asked: how can I round to two decimal places inside an optimization model? I.e., \[\color{darkred}y_{i,j} = \mathbf{round}(\color{darkred}x_{i,j},2) To get this off my chest first: I have never encountered a situation like this. Rounding to two decimal places is more for reporting than something we want inside model equations. Given that, let me look into this modeling problem a bit more as an exercise.  Of course, the first thing we can do is to drop the indices (as mathematicians would say: WLOG, Without Loss Of Generality). So we have as our problem: &n ..read more
Yet Another Math Programming Consultant
by Erwin Kalvelagen
4M ago
Lots of statistical procedures are based on an underlying optimization problem. Least squares regression and maximum likelihood estimation are two obvious examples. In a few cases, linear programming is used. Some examples are: Least absolute deviation (LAD) regression [1] Chebyshev regression [2] Quantile regression [3] Here is another regression example that uses linear programming. We want to estimate a sparse vector $$\color{darkred}\beta$$ from the linear model $$\color{darblue}y=\color{darkblue}X\color{darkred}\beta+\color{darkred}e$$ where the number of observations $$n$$ (rows in ..read more
Yet Another Math Programming Consultant
by Erwin Kalvelagen
4M ago
In [1], a small model is proposed: High-Level Model \begin{align} \min\> & \sum_i | \color{darkblue}a_i\cdot \color{darkred}x_i| \\ & \max_i |\color{darkred}x_i| = 1 \\ & \color{darkred}x_i \in \{-1,0,1\} \end{align} Can we formulate this as a straight MIP?  The objective is not very complicated. We can handle this with standard formulations, similar to what is used in LAD (Least Absolute Deviation) regression [2]. The constraint is more problematic. It can be interpreted as "at least one of the $$\color{darkred}x_i$$ should be nonzero". This type of counti ..read more
Yet Another Math Programming Consultant
by Erwin Kalvelagen
6M ago