lpsymphony - Integer Linear Programming in R

Similar documents
Package lpsymphony. February 6, 2018

Package Rglpk. May 18, 2017

3 INTEGER LINEAR PROGRAMMING

Solutions for Operations Research Final Exam

Introduction to Mathematical Programming IE496. Final Review. Dr. Ted Ralphs

Lesson 11: Duality in linear programming

Some Advanced Topics in Linear Programming

The MIP-Solving-Framework SCIP

Integer Programming Theory

MVE165/MMG631 Linear and integer optimization with applications Lecture 9 Discrete optimization: theory and algorithms

Optimization Methods in Management Science

Integer Programming Chapter 9

The University of Jordan Department of Mathematics. Branch and Cut

5.3 Cutting plane methods and Gomory fractional cuts

Solving lexicographic multiobjective MIPs with Branch-Cut-Price

Pure Cutting Plane Methods for ILP: a computational perspective

Introduction to Mathematical Programming IE406. Lecture 20. Dr. Ted Ralphs

Integer Programming as Projection

Linear Programming. Course review MS-E2140. v. 1.1

Unit.9 Integer Programming

TIM 206 Lecture Notes Integer Programming

MVE165/MMG630, Applied Optimization Lecture 8 Integer linear programming algorithms. Ann-Brith Strömberg

Gurobi Guidelines for Numerical Issues February 2017

56:272 Integer Programming & Network Flows Final Examination -- December 14, 1998

5. DUAL LP, SOLUTION INTERPRETATION, AND POST-OPTIMALITY

February 19, Integer programming. Outline. Problem formulation. Branch-andbound

Wireless frequency auctions: Mixed Integer Programs and Dantzig-Wolfe decomposition

Fundamentals of Integer Programming

Linear Programming with Bounds

Advanced Operations Research Prof. G. Srinivasan Department of Management Studies Indian Institute of Technology, Madras

The SYMPHONY Callable Library for Mixed-Integer Linear Programming

Outline. Column Generation: Cutting Stock A very applied method. Introduction to Column Generation. Given an LP problem

Column Generation: Cutting Stock

CS 473: Algorithms. Ruta Mehta. Spring University of Illinois, Urbana-Champaign. Ruta (UIUC) CS473 1 Spring / 36

Advanced Operations Research Prof. G. Srinivasan Department of Management Studies Indian Institute of Technology, Madras

TMA946/MAN280 APPLIED OPTIMIZATION. Exam instructions

Department of Mathematics Oleg Burdakov of 30 October Consider the following linear programming problem (LP):

Algorithms for Decision Support. Integer linear programming models

Advanced Operations Research Techniques IE316. Quiz 2 Review. Dr. Ted Ralphs

A hard integer program made easy by lexicography

(Duality), Warm Starting, and Sensitivity Analysis for MILP

Linear Programming and its Applications

Experiments On General Disjunctions

Computational Integer Programming. Lecture 12: Branch and Cut. Dr. Ted Ralphs

AM 121: Intro to Optimization Models and Methods Fall 2017

Generalized Network Flow Programming

Advanced Operations Research Prof. G. Srinivasan Department of Management Studies Indian Institute of Technology, Madras

Section Notes 4. Duality, Sensitivity, and the Dual Simplex Algorithm. Applied Math / Engineering Sciences 121. Week of October 8, 2018

15.082J and 6.855J. Lagrangian Relaxation 2 Algorithms Application to LPs

Math Models of OR: The Simplex Algorithm: Practical Considerations

Civil Engineering Systems Analysis Lecture XIV. Instructor: Prof. Naveen Eluru Department of Civil Engineering and Applied Mechanics

Integer Programming ISE 418. Lecture 1. Dr. Ted Ralphs

2 is not feasible if rounded. x =0,x 2

MATHEMATICS II: COLLECTION OF EXERCISES AND PROBLEMS

Selected Topics in Column Generation

BCN Decision and Risk Analysis. Syed M. Ahmed, Ph.D.

Financial Optimization ISE 347/447. Lecture 13. Dr. Ted Ralphs

9.4 SOME CHARACTERISTICS OF INTEGER PROGRAMS A SAMPLE PROBLEM

SUBSTITUTING GOMORY CUTTING PLANE METHOD TOWARDS BALAS ALGORITHM FOR SOLVING BINARY LINEAR PROGRAMMING

Heuristics in MILP. Group 1 D. Assouline, N. Molyneaux, B. Morén. Supervisors: Michel Bierlaire, Andrea Lodi. Zinal 2017 Winter School

The SYMPHONY Callable Library for Mixed-Integer Linear Programming

16.410/413 Principles of Autonomy and Decision Making

6 Randomized rounding of semidefinite programs

Dual-fitting analysis of Greedy for Set Cover

An Introduction to Dual Ascent Heuristics

DETERMINISTIC OPERATIONS RESEARCH

SUBSTITUTING GOMORY CUTTING PLANE METHOD TOWARDS BALAS ALGORITHM FOR SOLVING BINARY LINEAR PROGRAMMING

Part 4. Decomposition Algorithms Dantzig-Wolf Decomposition Algorithm

Linear programming and duality theory

5.4 Pure Minimal Cost Flow

Package Rcplex. June 12, 2016

1 Linear programming relaxation

The SYMPHONY Callable Library for Mixed-Integer Linear Programming

The Heuristic (Dark) Side of MIP Solvers. Asja Derviskadic, EPFL Vit Prochazka, NHH Christoph Schaefer, EPFL

Improved Gomory Cuts for Primal Cutting Plane Algorithms

1. Lecture notes on bipartite matching February 4th,

COLUMN GENERATION IN LINEAR PROGRAMMING

Linear Programming. Linear Programming. Linear Programming. Example: Profit Maximization (1/4) Iris Hui-Ru Jiang Fall Linear programming

Lagrangean relaxation - exercises

Pivot and Gomory Cut. A MIP Feasibility Heuristic NSERC

LP-Modelling. dr.ir. C.A.J. Hurkens Technische Universiteit Eindhoven. January 30, 2008

Combinatorial Optimization

Algorithms for Integer Programming

Outline. Modeling. Outline DMP204 SCHEDULING, TIMETABLING AND ROUTING. 1. Models Lecture 5 Mixed Integer Programming Models and Exercises

ME 391Q Network Flow Programming

Artificial Intelligence

A Dual Variant of. Benson s Outer Approximation Algorithm. for Multiple Objective Linear Programs

Primal Heuristics in SCIP

Section Notes 5. Review of Linear Programming. Applied Math / Engineering Sciences 121. Week of October 15, 2017

Motivation for Heuristics

Integer Programming. Xi Chen. Department of Management Science and Engineering International Business School Beijing Foreign Studies University

Integer Programming: Algorithms - 2

From the Separation to the Intersection Sub-problem in Benders Decomposition Models with Prohibitively-Many Constraints

Design and Analysis of Algorithms (V)

Simulation. Lecture O1 Optimization: Linear Programming. Saeed Bastani April 2016

On Mixed-Integer (Linear) Programming and its connection with Data Science

MATLAB Solution of Linear Programming Problems

Noncommercial Software for Mixed-Integer Linear Programming

Submodularity Reading Group. Matroid Polytopes, Polymatroid. M. Pawan Kumar

Introduction to Operations Research Prof. G. Srinivasan Department of Management Studies Indian Institute of Technology, Madras

Transcription:

lpsymphony - Integer Linear Programming in R Vladislav Kim October 30, 2017 Contents 1 Introduction 2 2 lpsymphony: Quick Start 2 3 Integer Linear Programming 5 31 Equivalent and Dual Formulations 5 32 Solving the Dual Problem 6 33 Methods in Integer Programming 6

1 Introduction Package lpsymphony adapts Symphony 1, an open-source mixed-integer linear programming (MILP) solver, for use in R This package is largely based on Rsymphony package distributed via CRAN 2 The point of divergence, however, is the inclusion of sources for POSIX systems and DLLs for Windows, which facilitates the installation of Symphony itself 2 lpsymphony: Quick Start 1 https://projects coin-ororg/ SYMPHONY 2 http://cran r-projectorg/ web/packages/ Rsymphony/index html The package exports lpsymphony_solve_lp() function, which provides a basic interface between the C code of SYMPHONY and R The user passes a vector with objective function coefficients, a constraint matrix and a vector of applicable inequality signs (ie,, =, etc) as parameters The function returns an optimal mixed or pure integer solution A simple example of function maximization would be subject to max {3x 1 + x 2 + 3x 3 } x 1 + 2x 2 + x 3 4 4x 2 3x 3 2 x 1 3x 2 + 2x 3 3 x 1, x 3 Z + x 2 R + In this simple mixed-integer problem we have 2 variables that are integer-valued (x 1 and x 3 ) and a rational variable (x 3 ) Note that in general variables x i of MILP problem are non-negative and hence a "+" subscript on Z + and R + To solve this maximization problem using lpsymphony include the package: library("lpsymphony") Define the vector of objective function coefficients In this case (3, 1, 3): obj <- c(3, 1, 3) Define the constraint matrix (left-hand side coefficients): 2

mat <- matrix(c(-1, 0, 1, 2, 4, -3, 1, -3, 2), nrow = 3) # mat <- matrix(c(-1,2,1,0,4,-3,1,-3,2), nrow = 3) Be careful not to mix up rows and columns! Here we create the matrix in the columnmajor order, ie reading off the matrix entries column by column (so vertically, not horizontally) Note that the matrix in the comment is not the same as the problem s constraint matrix In fact it is its transpose As explained in 31 this is the constraint matrix of the dual problem Next indicate the inequality (or equality) signs: dir <- c("<=", "<=", "<=") Vector of right-hand side values: rhs <- c(4, 2, 3) This is a maximization problem, thus: max <- TRUE Important: indicate which variables are integer-valued and which are allowed to be rational Possible options are "I" for integer, "B" for binary, "C" for continuous variable type types <- c("i", "C", "I") To obtain the optimal solution call lpsymphony_solve_lp() function: lpsymphony_solve_lp(obj, mat, dir, rhs, types = types, max = max) $solution [1] 500 275 300 $objval [1] 2675 $status TM_OPTIMAL_SOLUTION_FOUND 0 Setting Lower and Upper Bounds Another useful argument in lpsymphony is the bounds argument The default lower and upper bounds are zero and infinity, respectively 3

To change the default bounds pass a list of upper-bound and lower-bound lists (argument bounds is a list of lists) For instance, if you wish that all variables in the previous problem are continuous and between 1 and 5, you can bounds <- list(lower = list(ind = c(1,2,3), val = c(1,1,1)), upper = list(ind = c(1,2,3), val = c(5,5,5))) Now we need to change types to all continuous variables and pass bounds to lpsym phony_solve_lp: types <- c("c", "C", "C") lpsymphony_solve_lp(obj, mat, dir, rhs, types = types, max = max, bounds = bounds) $solution [1] 5000000 2857143 3285714 $objval [1] 2771429 $status TM_OPTIMAL_SOLUTION_FOUND 0 It is interesting to see if there are any integer solutions in the interval [1,5] and if they could be naively retrieved from rounding the previous solution: types <- c("i", "I", "I") lpsymphony_solve_lp(obj, mat, dir, rhs, types = types, max = max, bounds = bounds) $solution [1] 5 2 2 $objval [1] 23 $status TM_OPTIMAL_SOLUTION_FOUND 0 As one can see, integer solutions for x 2 and x 3 are not simply rounded values of the continuous case It is true in general that it is impossible to obtain an integer solution by simply rounding the solution up or down 4

3 Integer Linear Programming Given an objective function z = c T x, where c is a vector of objective coefficients, mixed-integer maximization can be formulated as max {c T x Ax b, x 0, x i Z} with the constraint matrix A and the right-hand-side vector b Note that here x i are all pure integers However, in geneal some of x i can be rational numbers In a linear programming (LP) relaxation the integer requirement is loosened and variables are allowed to take on continuous values to reach the first feasible solution or to conclude that the linear system doesn t have solutions Solving an optimization problem by first treating x as floating point numbers and rounding off the final result might produce a good estimate of integer solution However, finding an exact solution with LP relaxation does not produce accurate results in general 31 Equivalent and Dual Formulations Some care has to be taken in order to differentiate between an equivalent and dual formulations An equivalent way of stating the above maximization as a minimization problem would be to use the negative of c, vector of objective coefficients with constraint matrix A and RHS vector b same as above: min { c T x Ax b, x 0, x i Z} Every optimization problem can be viewed from 2 perspectives The inversion of the objective of the problem, not simply max min exchange and sign inversion in the objective function, leads to duality The original problem then is called a primal problem, while inversion of perspective gives rise to a dual problem A dual problem has a completely different interpretation than the primal and the following mathematical considerations have to be made For example, the dual of the above maximization task would be min {b T y A T y c, y 0, y i Z} Note that the dual objective function is b T y with the primal right-hand side vector b acting as the (dual) vector of objective coefficients The dual constraint matrix is the transpose of the original (primal) constraint matrix A and finally the dual right-hand side vector is the primal vector of objective coefficients c 5

32 Solving the Dual Problem Dual vector of objective coefficients is the primal RHS vector obj_dual <- rhs # rhs fom the Quick Start example The dual constraint matrix is the transpose of the primal A mat_dual <- t(mat) # mat from the Quick Start example Dual RHS vector is the primal objective vector rhs_dual <- obj Direction of dual signs is reversed with respect to primal dir_dual <- c(">=", ">=", ">=") Dual of maximization is minimization: max_dual <- FALSE Types can be used from the above program (in this case) To obtain the optimal solution of the dual problem (minimization): lpsymphony_solve_lp(obj_dual, mat_dual, dir_dual, rhs_dual, types = c("i","c","i"), max = max_dual) $solution [1] 2 3 5 $objval [1] 29 $status TM_OPTIMAL_SOLUTION_FOUND 0 33 Methods in Integer Programming The earliest approach to integer programming was Gomory s method of cutting planes developed in 1958 The basic principle is to solve the LP relaxation of the problem at the beginning of each iteration step and check whether the solution is integervalued If the found solution is integral, the optimum is found Otherwise, continue by generating new inequalities that usually lead to the tightening (Fig 1) of the 6

relaxation and then reoptimize The process stops when all variables in the solution vector are integers Fig 1 illustrates schematically how the candidate solution space of the LP shrinks upon addition of Gomory cuts Illustration of Gomory cutting plane method P(A,b) = original space of candidate solutions After Gomory cuts Figure 1: Gomory cuts reduce the number of candidate solutions P(A,b) is a polyhedron defined by the initial set of constraints Ax b The black dots indicate integers; dotted lines are Gomory cuts Modern integer linear programming solvers, however, do not solely utilize cutting plane algorithm to solve MILP problems Symphony uses primarily branch and bound and branch and cut methods Branch and bound is a tree search algorithm that divides the initial problem into subproblems (Fig 2) and eliminates invalid solutions by local and global bound checking Different variants of branch and bound exist Among implementation details are the following aspects: choice of the next tree node to be processed, the way bounds are calculated, the way the tree branches out, etc 7

Problem SP1 SP2 SP11 SP12 SP21 SP22 Figure 2: A sketch of a search tree generated by branch and bound SP stands for subproblem Branch and cut is a modification of branch and bound, in which cutting plane method is used to tighten LP relaxations With branch and cut one can generate cuts at the root of the tree (ie only in the beginning) or at every iteration of branch and bound Cut generation helps reduce the size of the tree and speeds up branch and bound 8