In this post I’ll show a way how to solve the Knapsack Problem applying a simple greedy improvement heuristic and how to implement it in R. What is the Knapsack Problem? On Wikipedia, you find the following definition: “The knapsack problem is a problem in combinatorial optimization: Given a set of items, each with a weight and a… Read more Solve Knapsack Problem with Heuristics in R

# Category: optimization

## Graph Notation

There are different types of graph notations. Here I’d like to present a nice and compact way in the form of a Vertex Lists and Edge Lists, which I came across during my studies at the MSE in Zurich. [Note: All graph images shown in this post have been taken from graphical representations of graphs… Read more Graph Notation

## Solve TSP Instance using Google OR-Tools

If you happen to have to solve TSPs or some special type of VRPs – i.e. capacitated or with timewindows and other constraints – you might want to have a look at Google OR-Tools. The library contains a wide variety of heuristics for different problems primarly based on google’s excellent constraint programming solver. The library… Read more Solve TSP Instance using Google OR-Tools

## Calculate an MST with Ant Colony Optimization in Python

Ant Colony Optimization is an old but still often applied construction heuristic to develop solutions using nature inspired behavior. The heuristic mimics the behavior of ants when finding shortest paths to between their nests and some kind of attraction, i.e. a food-source. The main idea are the pheromone trails, which ants leave behind, when travelling… Read more Calculate an MST with Ant Colony Optimization in Python

## Tabu Search in R

Here I’ll show you a way, how to do Tabu Search with Steepest Descent with best improvement in R. Tabu Search is a local improvement heuristic used to improve existing solutions. Such heuristics are also called local search heuristics. How does Local Search work? Local search can be described in words as follows: Take initial… Read more Tabu Search in R

## Configure multiple Users for GUROBI Cloud

What is the Objective If you are a small to medium scale solution provider for optimization solutions and want to provide solutions using the world’s best solver, then you should go for GUROBI cloud, since prices are most attractive and management of multiple users is quite simple. You will have to pay something like –… Read more Configure multiple Users for GUROBI Cloud

## Solve TSP using Pilot Method

This post shows a simple implementation using R to solve a given TSP (Traveling Salesperson Problem) instance using the Pilot Method. The whole R script can be accessed here on my gist. How does the Pilot Method work? The Pilot Method is a construction heuristic to build (i.e. initial) solutions. The method tries to avoid… Read more Solve TSP using Pilot Method

## Calling GUROBI from Matlab

In this post I’ll show you the steps you need to take, if you want to use the powerful GUROBI solver from Matlab in order to solve Mixed Integer Linear Programs. Install the GUROBI Solver Go to the Gurobi website, create an account and download the version applicable for your operating system here. Acquire and… Read more Calling GUROBI from Matlab

## Solve Optimization Tasks using GUROBI Cloud

What is the objective here? I will document the steps needed to setup Gurobi to solve a Linear Program in the cloud. For this example we will use a simple linear model and use Matlab to invoke the locally installed Gurobi solver, which in turn would forward it to a Gurobi Compute Server, which we… Read more Solve Optimization Tasks using GUROBI Cloud

## How to Solve Linear Models in Matlab using GUROBI

There are situations where you might want to use a specific Mathematical Programming solver and you might have to transform the mathematical model to comply with the API specifications of that Solver. Here I want to show you, how to adapt a Linear Model in order to run it within Matlab using the Gurobi solver.… Read more How to Solve Linear Models in Matlab using GUROBI