LP in statistics: The Dantzig Selector
Yet Another Math Programming Consultant
by Erwin Kalvelagen
3d 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
Visit website
Instead of integers use binaries
Yet Another Math Programming Consultant
by Erwin Kalvelagen
6d 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
Visit website
Math vs Programming
Yet Another Math Programming Consultant
by Erwin Kalvelagen
2M ago
 A programmer writes about this blog ..read more
Visit website
Small non-convex MINLP: Pyomo vs GAMS
Yet Another Math Programming Consultant
by Erwin Kalvelagen
2M ago
 In [1], the following Pyomo model (Python fragment) is presented: model.x = Var(name="Number of batches", domain=NonNegativeIntegers, initialize=10) model.a = Var(name="Batch Size", domain=NonNegativeIntegers, bounds=(5,20)) # Objective function def total_production(model): return model.x * model.a model.total_production = Objective(rule=total_production, sense=minimize) # Constraints # Minimum production of the two output products def first_material_constraint_rule(model): return sum(0.2 * model.a * i for i in range(1, value(model.x)+1)) >= 70 model.f ..read more
Visit website
One nonzero in set of free variables
Yet Another Math Programming Consultant
by Erwin Kalvelagen
2M ago
In [1] the following question is posed: I have free variables \(\color{darkred}x_i\). How can I impose the constraint that at least one of the variables is nonzero: \(\color{darkred}x_i\ne 0\). Observations \(\color{darkred}x_i\ne 0\) is somewhat difficult. We need to write this as \[\begin{align}&\color{darkred}x_i\le -\color{darkblue}\epsilon \\ & \textbf{or} \\ &  \color{darkred}x_i\ge \color{darkblue}\epsilon\end{align}\] Here \(\color{darkblue}\epsilon\gt 0\) is a small constant. This "or"-type of constraint needs a binary variable (or something similar). I ..read more
Visit website
GAMS listing file: missing Unicode support
Yet Another Math Programming Consultant
by Erwin Kalvelagen
3M ago
Newer versions of GAMS allow UTF-8 encoded strings as labels. That is very welcome, as these labels may come from data sources that just use Unicode characters. However, when printing to the listing file, we miss proper Unicode support. At first, I thought, "OK, just a few misaligned tables. No big deal." Here is a constructed example showing this may be a bit more problematic. $onText The chars ? in the labels below are Unicode characters (U+1D6FD). The name is "Mathematical Italic Small Beta" In UTF-8 encoding they occupy 4 bytes: 0xF0 0x9D 0x9B 0xBD $offText set j /col1*col2/; paramet ..read more
Visit website
String Art
Yet Another Math Programming Consultant
by Erwin Kalvelagen
3M ago
  In [1], a greyscale picture is approximated by strings (lines) between points around the image. Here, I will try something similar with a formal optimization model. A greyscale image can be represented by an \(m\times n\) matrix of floating point values between zero and one. A value of zero indicates a black pixel, and a value of one a white pixel. In the discussion below, when I use the term color, this means the greyscale value. Here is a \(160\times 120\) image. The pixels have values between 0 and 0.97. Let's call this matrix \(\color{darkblue}{\mathit{GreyScale}}_{i,j} \in ..read more
Visit website
Grouping items: a difficult combinatorial problem
Yet Another Math Programming Consultant
by Erwin Kalvelagen
5M ago
In [1], a simple problem is described: We have \(n\) items (or orders) with a certain width.  We need to combine these items in groups (called patterns) with rather tight limits on the total width. The total length of a pattern (the sum of the lengths of the items assigned to this pattern) must be between 335 and 340. As a result, we may not be able to assign all items. The remaining items cannot be formed into valid patterns. The objective is to try to place as many items as possible into patterns. An indication of the size of the problem: \(n \approx 500\).   Data Instea ..read more
Visit website
Scheduling Team Meetings
Yet Another Math Programming Consultant
by Erwin Kalvelagen
6M ago
This is a simple problem from [1]: I'm rusty on constraint optimization and am looking for help in this particular use case. There are individuals who are each member to several teams. This is a fixed many-to-many relationship and is determined a-priori. There are 3 time slots where the teams can be scheduled to conduct a business meeting, but if an individual is a member of more than one team which are both meeting at a given time slot, they'll only be able to attend one. The objective is to schedule the teams into the time slots, minimizing the number of overlaps of individuals. For begi ..read more
Visit website
GAMS: SMAX and sparsity
Yet Another Math Programming Consultant
by Erwin Kalvelagen
6M ago
This is a discussion about the SMAX function in GAMS and how it behaves for sparse data. The data structure we were facing was something like: set i 'cases' /case1*case100000/ j 'attribute' /j1*j25/ k 'attribute' /k1*k25/ t 'type' /typ1*typ2/ ; parameter p(i,j,k,t) 'positive numbers'; * note: for each i we have only one (j,k) The data for parameter \(\color{darkblue}p_{i,j,k,t}\) is originating from a database. A small (simulated) data set can look like: ---- 20 PARAMETER p positive numbers typ1 typ2 case1 .j5 .k22 0.550 0.301 case2 .j8 .k6 0.350 0.856 case3 .j2 .k13 0.998 0.579 ca ..read more
Visit website

Follow Yet Another Math Programming Consultant on FeedSpot

Continue with Google
Continue with Apple
OR