New Book: R for Data Science; Visualize, Model, Transform, Tidy and Import Data
Recommended introductory text. It discusses some packages I was not really familiar with (like tibble).ContentsPart I. Explore1. Data Visualization with ggplot22. Workflow: Basics3. Data Transformation...
View ArticleMIP Starts sometimes disappoint
Modern MIP solvers allow to use a good integer solution to “warm start” the branch and bound process. This looks like a very good approach to cut down on total solution times, and it sometimes is. But...
View ArticleEmployee Scheduling I: Matlab vs GAMS
In (1) a small employee scheduling problem is modeled as a simple MIP model using MATLAB. Basically from the data on employee availability, we need to form all possible shifts. Even for small data sets...
View ArticleEmployee Scheduling II: column generation
In (1) and (2) an Employee Scheduling model is considered where all possible shifts are enumerated before we solve the actual model. Although such models models tend to solve quickly (especially...
View ArticleEmployee Scheduling III: generating all shifts using the Cplex solution pool
In (1) and (2) all possible shifts for a small Employee Scheduling problem are calculated by programming. In (3) we generate new shifts one by one using MIP model as part of a Column Generation...
View ArticleMIP modeling: Selecting subsets
Consider the following problem:We have a population of items with values having a mean \(\mu\). Furthermore we have a number of subsets of this population. Each subset \(i\) has a known count \(n_i\)...
View ArticleLittle trick: random positive definite matrix
Sometimes we want to test a model with some random data. When dealing with quadratic problems we may need to invent a positive definite matrix \(Q\). One simple way to do this is as follows:I.e. in...
View ArticleFailing to use optimal solution as initial point
In a somewhat complex non-linear programming model, I observed the following. I do here two solves in a row:solve m2 minimizing zrf using dnlp;solve m2 minimizing zrf using dnlp;We solve the model, and...
View ArticleNew book: Testing R Code
Table of contentsIntroduction Run-Time Testing with assertiveDevelopment-Time Testing with testthatWriting Easily Maintainable and Testable Code Integrating Testing into Packages Advanced...
View ArticleA script to generate power pivot tables
In (1) I provided a script to generate an Excel spreadsheet containing a pivot table that used a CSV file as external data source. Essentially the pivot table provides a view of the data in the CSV...
View ArticleSolving Kakuro puzzles as a MIP
The Kakuro puzzle is another logical puzzle similar to Sudoku, KenKen and Takuzu. A small example from (1) is: The rules are as follows:Each (white) cell must be filled with a value \(1,..,9\). Each...
View ArticleMultiplication of binary with continuous variable between zero and one
A small tidbit. The standard linearization for the multiplication of two binary variables \(z=x \cdot y\) with \(x,y \in \{0,1\}\) is: \[\boxed{\begin{align}&z\le x\\&z \le y\\& z\ge...
View ArticlePython Optimization Modeling: optlang
Example with Transportation Model from (1) taken from the optlang docs:fromoptlangimportVariable,Constraint,Objective,Model# Define problem parameters# Note this can be done using any of Python's data...
View ArticleComparing two GAMS models
I see a lot of GAMS models. Some of them are really beautifully done. Others, I would like to suggest some edits. Here we compare two different models that solve a Kakuro puzzle. The problem from (1)...
View ArticleStrict Inequalities in Optimization Models
An often seen question is: Can I write an inequality of the form: \[\sum_i a_i x_i < b \]The obvious answer is no. LP, MIP and NLP solvers only allow \(\le\) and \(\ge\) inequalities. Here are some...
View ArticleRunning GAMS from Excel
Small demo: Run a GAMS model from Excel.Some VBA code is used to locate the GAMS system, launch GAMS and provide a log window.When visiting clients, whether commercial companies or government agencies...
View ArticleMulti-objective model with millions of objectives?
From (1):I have a multi-objective optimization problem [] where I have about 100 millions of lines to maximize or minimize (objective functions).When I searched about which algorithm should I use,...
View Articleifthen adventures in GAMS (and R)
GAMS has a function ifthen which can be used in equations. For example:e.. y =e= ifthen(x<1,(1+x)/2,sqrt(x));This function implements:\[y=\begin{cases}\displaystyle\frac{1+x}{2}&\text{if...
View ArticleMore meta-heuristics by combining them
Arguably the number of different meta-heuristics \(N\) is already too large. One simple way to to make this number quickly \(N^2\) is to combine them. Here this is done with Leaping Frogs and...
View ArticleEmployee Scheduling IV: direct optimization
In (1) a small employee scheduling problem is proposed. It is solved by first generating all possible shifts for each employee, and then solving a very simple MIP (Mixed Integer Programming) model to...
View Article