Solving Constraint Integer Programs

main_vrp.cpp File Reference

Detailed Description

main file for VRP pricer example

Andreas Bley
Marc Pfetsch

We want to solve the vehicle routing problem on a graph G = (V,E) with V = J cup {d}, where d is the depot and the distances are given by the length function l_e: E -> R_{>= 0}.

Consider the MIP formulation

min sum_{e in E} l_e y_e s.t. -y_e + sum_{t in T_k} a^t_e x_t <= 0, for all e in E sum_{t in T_k} a^t_j x_t == 1, for all j in J y(delta(j)) == 2, for all j in J y_e in {0,1,2}, for all e in E x_t in [0,1], for all t in T_k

where T_k is the set of tours visiting at most k customers with repetitions of customers allowed and a^t_e (a^t_j) counts how often edge e (node j) is traversed in t in T_k.

Examples and the file format are given at

Definition in file main_vrp.cpp.

#include <stdio.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include "objscip/objscip.h"
#include "objscip/objscipdefplugins.h"
#include "pricer_vrp.h"

Go to the source code of this file.


static int read_problem (const char *filename, int &num_nodes, int &capacity, vector< int > &demand, vector< vector< int > > &dist)
static SCIP_RETCODE execmain (int argc, char **argv)
int main (int argc, char **argv)

Function Documentation

◆ read_problem()

static int read_problem ( const char *  filename,
int &  num_nodes,
int &  capacity,
vector< int > &  demand,
vector< vector< int > > &  dist 

read VRP problem

num_nodesnumber of nodes in instance
capacitycapacity in instance
demandarray of demands of instance
distdistances between nodes

Definition at line 63 of file main_vrp.cpp.

References sqrt(), x, and y.

Referenced by execmain().

◆ execmain()

◆ main()

int main ( int  argc,
char **  argv 

Definition at line 479 of file main_vrp.cpp.

References execmain(), and SCIP_OKAY.