Quantcast
Channel: Yet Another Math Programming Consultant
Browsing all 805 articles
Browse latest View live

Image may be NSFW.
Clik here to view.

Nonlinear equations and CONOPT

The problemWhen we want to generate some random draws from an exotic probability distribution, the following algorithm may help:Generate \(u_i \sim U(0,1)\) from a uniform distribution. Solve \(F(x_i)...

View Article


Semi-Continuous Variables and the Solution Pool

In this post I consider the interaction between semi-continuous variables and the solution pool in Cplex and Gurobi. I received a question about this, and I had to try things about before I could give...

View Article


Small GAMS trick: $eval

In GAMS we typically first declare sets and and then deduce things like the number of elements in a set:set i/i1*i20/;scalar n;n = card(i);Often the question comes up: Can I do it the other way around?...

View Article

RStudio Tips and Tricks

From: https://youtu.be/kuSQgswZdr8and then I read this: Why R is Bad for YouSummary: Someone had to say it.  In my opinion R is not the best way to learn data science and not the best way to practice...

View Article

Image may be NSFW.
Clik here to view.

Simple piecewise linear problem, not so easy with binary variables

The following picture illustrates the problem:The blue line is what we want to model:\[\bbox[lightcyan,10px,border:3px solid darkblue]{   y = \begin{cases}    0 & \text{if $0 \le x \le a$}\\...

View Article


Journalist explaining statistics

I would call this explanation, well, below average:Take that bit about the bell curve of IQ. It’s an unpleasant fact that half of all people are of below average IQ. It’s also true that half of all...

View Article

Image may be NSFW.
Clik here to view.

Indexing economic time series in R

When we want to compare different (economic) data, an often used approach is indexing. We choose one year (often the beginning of the time series) as the base year. We then normalize each time series...

View Article

Image may be NSFW.
Clik here to view.

Working on an R package….

The C++ code (parsing Excel formulas so we can for instance execute them) is not working 100% correctly as of now…Time to make it work under a debugger (amazingly I did not need a debugger until...

View Article


Minimum down- and up-time

In machine scheduling models we sometimes want to impose minimum up-time and minimum down-time restrictions. E.g., from (1):My question is how do I add in additional constraints that if the factory...

View Article


Image may be NSFW.
Clik here to view.

A Staffing Problem

In (1) a "simple problem" is stated (problems are rarely as simple as they seem):For the next 18 weeks there is some data about demand for staffing resources:Actually we don’t need the data for the...

View Article

Image may be NSFW.
Clik here to view.

Modeling production runs with length exactly three

In (1) the question was posed how to model production runs that have an exact length. Although the question was asked in terms of integer variables, this is much easier to deal with when we have binary...

View Article

Minimizing the k-th largest x

Minimizing the largest \(x_i\) is an easy exercise in LP modeling: \[\bbox[lightcyan,10px,border:3px solid darkblue] { \begin{align} \min\>& z\\ & z \ge x_i \end{align}} \] This is sometimes...

View Article

Image may be NSFW.
Clik here to view.

Who needs Cplex or Gurobi: solving LPs using LU

The strange notion that linear programming problems can be solved simply by applying an LU decomposition (not as part of the Simplex method but just LU) seems to take hold. The original idea is from...

View Article


Image may be NSFW.
Clik here to view.

GLPK was used in the proof of the 300 year old Kepler conjecture

A lot of authors.Apparently 43,078 LPs had to be solved.ReferencesThomas Hales e.a., A Formal Proof of the Kepler Conjecture, Forum of mathematics, Pi (2017), vol 5, e2,...

View Article

Image may be NSFW.
Clik here to view.

Rectangles: no-overlap constraints

The question of how we can formulate constraints that enforce rectangles not to overlap comes up regularly (1). There are basically four cases to consider when considering two rectangles \(i\) and...

View Article


Image may be NSFW.
Clik here to view.

Modeling flood damages

While working on a investment planning model to combat damages resulting from flooding, I received the results from a rainfall model that calculates damages as a result of excessive rain and flooding....

View Article

Image may be NSFW.
Clik here to view.

Ubuntu Bash on Windows

Windows 10 has a beta feature: Bash.exe with an Ubuntu Linux subsystem (see (1) and (2)), also known as WSL (Windows Subsystem for Linux). This will allow you to run Linux command line tools from...

View Article


Image may be NSFW.
Clik here to view.

no loops please

In (1) a piece of matlab code is presented:There may be better way to formulate this in Matlab.  In many languages, including Matlab, R and GAMS loops are considered bad if there are alternatives. To...

View Article

The CDF of the Gamma distribution in GAMS

For a model (1) I needed to calculate the cumulative distribution function \(F(x)\) of the Gamma distribution. There is no uniform consensus:  Gamma distribution has different parametrizations. I use...

View Article

Image may be NSFW.
Clik here to view.

Element renaming

In GAMS set elements (used for indexing) are strings. This means it is not necessary to use non-descriptive numbers as in:set i /1*50/;Actually, even with numbered elements, it is good practice to...

View Article
Browsing all 805 articles
Browse latest View live


Latest Images