COIN-OR: Software Tools for Implementing Custom Solvers

Similar documents
Building a Custom Solver with the COIN-OR Branch, Cut, and Price Frameworks

Using COIN-OR to Solve the Uncapacitated Facility Location Problem

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

Implementing Scalable Parallel Search Algorithms for Data-Intensive Applications

The SYMPHONY Callable Library for Mixed-Integer Linear Programming

An Open Source Solver for Bicriteria Mixed Integer Programs

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

sbb COIN-OR Simple Branch-and-Cut

Doing It in Parallel (DIP) with The COIN-OR High-Performance Parallel Search Framework (CHiPPS)

Doing It in Parallel (DIP) with The COIN-OR High-Performance Parallel Search Framework (CHiPPS)

sbb COIN-OR Simple Branch-and-Cut

Linking GAMS to Solvers Using COIN-OSI. Michael Bussieck Steve Dirkse GAMS Development Corporation

Implementing Custom Applications with CHiPPS. INFORMS Annual Conference, San Diego, CA October 12, 2009

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

Fundamentals of Integer Programming

Experience with CGL in the PICO Mixed- Integer Programming Solver

The MIP-Solving-Framework SCIP

Noncommercial Software for Mixed-Integer Linear Programming

Solving lexicographic multiobjective MIPs with Branch-Cut-Price

Computational Experience with Parallel Integer Programming using the CHiPPS Framework. INFORMS Annual Conference, San Diego, CA October 12, 2009

The SYMPHONY Callable Library for Mixed-Integer Linear Programming

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

Modeling with COIN-OR Tools

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

An open-source stochastic programming solver. H.I. Gassmann, Dalhousie University J. Ma, JTechnologies R.K. Martin, The University of Chicago

3 INTEGER LINEAR PROGRAMMING

Tools for Modeling Optimization Problems A Short Course. Algebraic Modeling Systems. Dr. Ted Ralphs

Parallel Branch, Cut, and Price for Large-Scale Discrete Optimization

Algorithms for Decision Support. Integer linear programming models

The SYMPHONY Callable Library for Mixed-Integer Linear Programming

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

Mixed Integer Programming Class Library (MIPCL)

TIM 206 Lecture Notes Integer Programming

SYMPHONY 4.0 User s Manual 1

BAC : A BCP based Branch-and-Cut Example. François Margot 1

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

Column Generation: Cutting Stock

Integer Programming Chapter 9

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

Implementing Scalable Parallel Search Algorithms for Data-intensive Applications

lpsymphony - Integer Linear Programming in R

LaGO - A solver for mixed integer nonlinear programming

DIP and DipPy: Towards a Decomposition-based MILP Solver. International Symposium on Mathematical Programming, August 2012

5.3 Cutting plane methods and Gomory fractional cuts

Advanced Use of GAMS Solver Links

A Generic Separation Algorithm and Its Application to the Vehicle Routing Problem

CoinEasy. Kipp Martin Booth School of Business University of Chicago. November 9, 2010

Assessing Performance of Parallel MILP Solvers

Integer Programming: Algorithms - 2

yaposib Documentation

Cloud Branching MIP workshop, Ohio State University, 23/Jul/2014

Welcome to the Webinar. What s New in Gurobi 7.5

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

The Gurobi Optimizer. Bob Bixby

Column Generation Based Primal Heuristics

SCIP Workshop 2014, Berlin, September 30, Introduction to SCIP

Linear & Integer Programming: A Decade of Computation

Source Code Not Required: Using the COIN-OR Binaries

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

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

The SAS/OR s OPTMODEL Procedure :

Parallel Branch & Bound

DETERMINISTIC OPERATIONS RESEARCH

Exact solutions to mixed-integer linear programming problems

High performance computing and the simplex method

Algorithms for Integer Programming

Solutions for Operations Research Final Exam

SYMPHONY User s Manual 1

GAMS. General Algebraic Modeling System. EURO 2009 Bonn. Michael Bussieck Jan-Hendrik Jagla

LP SCIP NEOS URL. example1.lp 2.1 LP 1. minimize. subject to, bounds, free, general, binary, end. .lp 1 2.2

Pivot and Gomory Cut. A MIP Feasibility Heuristic NSERC

Unit.9 Integer Programming

Optimization Services (OS) Today: open Interface for Hooking Solvers to Modeling Systems

Gurobi Guidelines for Numerical Issues February 2017

Restrict-and-relax search for 0-1 mixed-integer programs

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

Benders in a nutshell Matteo Fischetti, University of Padova

SYMPHONY User s Manual 1

AMPL Integer Linear Programming And Sensitivity Analysis for LP. ORLAB Operations Research Laboratory. Borzou Rostami. Politecnico di Milano, Italy

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

DIP with CHiPPS: Decomposition Methods for Integer Linear Programming. CSIRO, Melbourne, Australia, 19 December, 2011

Machine Learning for Software Engineering

Parallel Branch-and-Cut for Optimization in Production Planning

Tutorial on Integer Programming for Visual Computing

Basic Concepts of Constraint Integer Programming

Branch-and-cut implementation of Benders decomposition Matteo Fischetti, University of Padova

Computational Integer Programming. Lecture 3: Software. Dr. Ted Ralphs

Primal Heuristics in SCIP

Facility Location-Routing-Scheduling Problem: LRS

Improved Gomory Cuts for Primal Cutting Plane Algorithms

Progress in Linear Programming-Based Algorithms for Integer Programming: An Exposition

Free modelling languages for linear and integer programming

CSDP User s Guide

CSDP User s Guide. Brian Borchers. November 1, 2006

DIP with CHiPPS: Decomposition Methods for Integer Linear Programming. ExxonMobil, 21 October 2011

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

Conflict Analysis in Mixed Integer Programming

IBM ILOG CPLEX Optimization Studio Getting Started with CPLEX for MATLAB. Version 12 Release 6

The Supporting Hyperplane Optimization Toolkit A Polyhedral Outer Approximation Based Convex MINLP Solver Utilizing a Single Branching Tree Approach

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

Transcription:

COIN-OR: Software Tools for Implementing Custom Solvers Ted Ralphs Lehigh University László Ladányi IBM T. J. Watson Research Center Matthew Saltzman Clemson University Institute for Operations Research and Management Science Annual Conference, October 19, 2003

Overview of COIN-OR 1 Agenda Overview of COIN-OR Overview of COIN-OR branch, cut, and price toolbox BCP OSI CGL CLP VOL Developing an application Basic concepts Design of BCP User API Example

Overview of COIN-OR 2 What is COIN-OR? The COIN-OR Project A consortium of researchers in both industry and academia dedicated to improving the state of computational research in OR. An initiative promoting the development and use of interoperable, open-source software for operations research. Soon to become a non-profit corporation known as the COIN-OR Foundation The COIN-OR Repository A library of interoperable software tools for building optimization codes, as well as a few stand alone packages. A venue for peer review of OR software tools. A development platform for open source projects, including a CVS repository.

Overview of COIN-OR 3 What is Open Source Development? Open source development is a coding paradigm in which development is done in a cooperative and distributed fashion. Strictly speaking, an open source license must satisfy the requirements of the Open Source Definition. A license cannot call itself open source until it is approved by the Open Source Initiative. Basic properties of an open source license Access to source code. The right to redistribute. The right to modify. The license may require that modifications also be kept open.

Overview of COIN-OR 4 Our Agenda Accelerate the pace of research in computational OR. Reuse instead of reinvent. Reduce development time and increase robustness. Increase interoperability (standards and interfaces). Provide for software what the open literature provides for theory. Peer review of software. Free distribution of ideas. Adherence to the principles of good scientific research. Define standards and interfaces that allow software components to interoperate. Increase synergy between various development projects. Provide robust, open-source tools for practitioners.

INFORMS COIN-OR Workshop 5 Components of the COIN-OR Library COIN OSI CGL BCP VOL CLP SBB NLPAPI IPOPT DFO MULTIFARIO OTS Branch, cut, price toolbox OSI: Open Solver Interface CGL: Cut Generator Library BCP: Branch, Cut, and Price Library VOL: Volume Algorithm CLP: COIN-OR LP Solver SBB: Simple Branch and Bound COIN: COIN-OR Utility Library Stand-alone components IPOPT: Interior Point Optimization NLPAPI: Nonlinear Solver interface DFO: Derivative Free Optimization MULTIFARIO: Solution Manifolds OTS: Open Tabu Search

Overview of BCP Toolbox 6 Agenda Overview of COIN-OR Overview of COIN-OR branch, cut, and price toolbox BCP OSI CGL CLP VOL Developing an application Basic concepts Design of BCP User API Example

Overview of BCP Toolbox 7 BCP Overview Concept: Provide a framework in which the user has only to define the core relaxation, along with classes of dynamically generated variables and constraints. Branch and bound core relaxation only Branch and cut core relaxation plus constraints Branch and price core relaxation plus variables Branch, cut, and price the whole caboodle Existing frameworks SYMPHONY (parallel, C) COIN/BCP (parallel, C++) ABACUS (sequential, C++) Components Framework (BCP) LP Solver (OSI) Cut Generator (CGL) Utilities (COIN)

Overview of BCP Toolbox 8 OSI Overview Uniform interface to LP solvers, including: CLP (COIN-OR) CPLEX (ILOG) DyLP (BonsaiG LP Solver) GLPK (GNU LP Kit) OSL (IBM) SoPlex (Konrad-Zuse-Zentrum für Informationstechnik Berlin) Volume (COIN-OR) XPRESS (Dash Optimization) MOSEK (under construction)

Overview of BCP Toolbox 9 CGL Overview Collection of cut generation routines integrated with OSI. Intended to provide robust implementations, including computational tricks not usually published. Currently includes: Simple rounding cut Gomory cut Knapsack cover cut Rudimentary lift-and-project cut Odd hole cut Probing cut

Overview of BCP Toolbox 10 VOL Overview Generalized subgradient optimization algorithm. Compatible with branch, cut, and price: provides approximate primal and dual solutions, provides a valid lower bound (feasible dual solution), and provides a method for warm starting.

Overview of BCP Toolbox 11 CLP Overview A full-featured, open source LP solver. Has interfaces for primal, dual, and network simplex. Can be accessed through the OSI. Reasonably robust and fast.

Overview of BCP Toolbox 12 SBB Overview A lightweight generic MIP solver. Uses OSI to solve the LP relaxations. Uses CGL to generate cuts. Optimized for CLP.

INFORMS COIN-OR Workshop 13 COIN Utility Library Overview Contains classes for Storage and manipulation of sparse vectors and matrices. Factorization of sparse matrices. Storage of solver warm start information. Message handling. Reading/writing of MPS files. Other utilities (simultaneous sorting, timing,... ). These are the classes common to many of the other algorithms.

Developing an Application 14 Agenda Overview of COIN-OR Overview of COIN-OR branch, cut, and price toolbox BCP OSI CGL CLP VOL Developing an application Basic concepts Design of BCP User API Example

Developing an Application 15 Basic Concepts We consider problem P : min c T x s.t. Ax b x i Z i I where A R m n, b R m, c R n. Let P = conv{x R n : Ax b, x i Z i I}. Basic Algorithmic Approach Use LP relaxations to produce lower bounds. Branch using hyperplanes. The LP relaxations are built up from a core relaxation with dynamically generated objects (variables and constraints).

Developing an Application 16 Object Generation The efficiency of BCP depends heavily on the size (number of rows and columns) and tightness of the LP relaxations. Tradeoff Small LP relaxations faster LP solution. Big LP relaxations better bounds. The goal is to keep relaxations small while not sacrificing bound quality. We must be able to easily move constraints and variables in and out of the active set. This means dynamic generation and deletion. Defining a class of objects consists of defining methods for generating new objects, given the primal/dual solution to the current LP relaxation, representing the object (for storage and/or sharing), and adding objects to a given LP relaxation.

Developing an Application 17 Getting Started The source can be obtained from www.coin-or.org as tarball or using CVS. Platforms/Requirements Linux, gcc 2.95.3/2.96RH/3.2/3.3 Windows, Visual C++, CygWin make (untested) Sun Solaris, gcc 2.95.3/3.2 or SunWorkshop C++ AIX gcc 2.95.3/3.3 Mac OS X Editing the Makefiles Makefile.location Makefile.<operating system> Make the necessary libraries. They ll be installed in ${CoinDir}/lib. Change to appropriate directory and type make.

Developing an Application 18 BCP Modules The BCP library is divided into three basic modules: Tree Manager Controls overall execution by maintaining the search tree and dispatching subproblems to the node processors. Node Processor Perform processing and branching operations. Object Generation Generate objects (cuts and/or variables). The division into separate modules is what allows the code to be parallelizable.

Developing an Application 19 The User API The user API is implemented via a C++ class hierarchy. To develop an application, the user must derive the appropriate classes override the appropriate methods. Classes for customizing the behavior of the modules BCP tm user BCP lp user BCP cg user BCP vg user Classes for defining user objects BCP cut BCP var BCP solution Allowing BCP to create instances of the user classes. The user must derive the class USER initialize. The function BCP user init() returns an instance of the derived initializer class.

Developing an Application 20 Objects in BCP Most application-specific methods are related to handling of objects. Since representation is independent of the current LP, the user must define methods to add objects to a given subproblem. For parallel execution, the objects need to be packed into (and unpacked from) a buffer. Object Types Core objects are objects that are active in every subproblem (BCP xxx core). Indexed objects are extra objects that can be uniquely identified by an index (such as the edges of a graph) (BCP xxx indexed). Algorithmic objects are extra objects that have an abstract representation (BCP xxx algo).

Developing an Application 21 Forming the LP Relaxations in BCP The current LP relaxation looks like this: core vars extra vars core cuts core matrix extra cuts Reason for this split: efficiency.

Developing an Application 22 BCP Methods: Initialization Solver Initialization (Tree Manager) BCP_user_init() xx_init() initialize_core() create_root() Create and initialize the user s data structures Set the core and extra variables and cuts pack_module_data() Send data to the modules

Developing an Application 23 BCP Methods: Steady State (un)pack_xxx_algo() display_feasible_solution() compare_tree_nodes() Tree Manager unpack_module_data() generate_cuts() pack_cut_algo() Cut Generator unpack_module_data() initialize_search_tree_node() See the solver loop figure LP Solver unpack_module_data() generate_vars() pack_var_algo() Variable Generator

Developing an Application 24 BCP Methods: Node Processing Loop modify_lp_parameters() test_feasibility() generate_heuristic solution() pack_{primal/dual}_solution() Possible fathoming pack_feasible_solution() Send primal and dual solutions to CG and VG unpack_{var/cut}_algo() generate_{vars/cuts}_in_lp() compare_{vars/cuts}() Generating and comparing cuts and variables vars_to_cols() / cuts_to_rows() logical_fixing() select_branching_candidates() compare_branching_candidates() Strong branching functions set_actions_for_children() purge_slack_pool()

Developing an Application 25 Parameters and using the finished code Create a parameter file Run your code with the parameter file name as an argument (command line switches will be added). BCP_ for BCP s parameters Defined and documented in BCP tm par, BCP lp par, etc. Helper class for creating your parameters. Output controlled by verbosity parameters.

Developing an Application 26 Agenda Overview of COIN-OR Overview of COIN-OR branch, cut, and price toolbox BCP OSI CGL CLP VOL Developing an application Basic concepts Design of BCP User API Example

Developing an Application 27 Example: Uncapacitated Facility Location Data a set N of facilities and a set M of clients, transportation cost c ij to service client i from depot j, fixed cost f j for using depot j, and the demand of d i of client i. Variables x ij is the amount of the demand for client i satisfied from depot j y j is 1 if the depot is used, 0 otherwise min i M s.t. j N c ij x ij + f j y j d i j N x ij = d i i M, j N x ij ( i M i M y j {0, 1} d i )y j j N, j N 0 x ij d i i M, j N

Developing an Application 28 UFL: Solution Approach The code for this example is available at http://sagan.ie.lehigh.edu/coin/uflbcp.tar.gz We use a simple branch and cut scheme. We dynamically generate the following class disaggregated logical cuts x ij <= d j y j, i M, j N (1) These can be generated by complete enumeration. The indices i and j uniquely identify the cut., so we will use this to create the packed form. The core relaxation will consist of the LP relaxation.

Developing an Application 29 UFL: User classes User classes and methods UFL init tm init() lp init() UFL lp unpack module data() pack cut algo() unpack cut algo() generate cuts in lp() cuts to rows() UFL tm read data() initialize core() pack module data() UFL cut

Developing an Application 30 UFL: Initialization Methods USER_initialize * BCP_user_init() { return new UFL_init; } BCP_lp_user * UFL_init::lp_init(BCP_lp_prob& p) { return new UFL_lp; } BCP_tm_user * UFL_init::tm_init(BCP_tm_prob& p, const int argnum, const char * const * arglist) { UFL_tm* tm = new UFL_tm; tm->tm_par.read_from_file(arglist[1]); tm->lp_par.read_from_file(arglist[1]); return tm; }

Developing an Application 31 BCP Buffers One construct that is pervasive in BCP is the BCP buffer. A BCP buffer consists of a character string into which data can be packed for storage or communication (parallel code). The usual way of adding data to a buffer is to use the pack() method. The pack method returns a reference to the buffer, so that multiple calls to pack() can be strung together. To pack integers i and j into a buffer and then unpack from the same buffer again, the call would be: int i = 0, j = 0; BCP_buffer buf; buf.pack(i).pack(j); buf.unpack(i).unpack(j);

Developing an Application 32 UFL: Module Data Because BCP is a parallel code, there is no shared between modules. The pack module data() and unpack module data() methods allow instance data to be broadcast to other modules. In the UFL, the data to be broadcast consists of the number of facilities (N), the number of clients (N), and the demands. Here is what the pack and unpack methods look like. void UFL_tm::pack_module_data(BCP_buffer& buf, BCP_process_t ptyp { lp_par.pack(buf); buf.pack(m).pack(n).pack(demand,m); } void UFL_lp::unpack_module_data(BCP_buffer& buf) { lp_par.unpack(buf); buf.unpack(m).unpack(n).unpack(demand,m).unpack(capacity,n); }

Developing an Application 33 UFL: Initializing the Core The core is specified as an instance of the BCP lp relax class, which can be constructed from either a vector of BCP rows or BCP cols, and a set of rim vectors. In the initialize core() method, the user must also construct a vector of BCP cut core and BCP var core objects.

Developing an Application 34 UFL: Initializing the Solver Interface In the BCP lp user class, we must initialize the solver interface to let BCP know what solver we want to use. Here is what that looks like: OsiSolverInterface* UFL_lp::initialize_solver_interface(){ #if COIN_USE_OSL OsiOslSolverInterface* si = new OsiOslSolverInterface(); #endif #if COIN_USE_CPX OsiCpxSolverInterface* si = new OsiCpxSolverInterface(); #endif #if COIN_USE_CLP OsiClpSolverInterface* si = new OsiClpSolverInterface(); #endif return si; }

Developing an Application 35 UFL: Cut Class class UFL_cut : public BCP_cut_algo{ public: int i,j; public: UFL_cut(int ii, int jj): BCP_cut_algo(-1 * INF, 0.0), i(ii), j(jj) { } UFL_cut(BCP_buffer& buf): BCP_cut_algo(-1 * INF, 0.0), i(0), j(0) { buf.unpack(i).unpack(j); } void pack(bcp_buffer& buf) const; }; inline void UFL_cut::pack(BCP_buffer& buf) const{ buf.pack(i).pack(j); }

Developing an Application 36 UFL: Generating Cuts To find violated cuts, we simply enumerate, as in this code snippet. double violation; vector< pair<int,int> > cut_v; map<double,int> cut_violation; //map keeps violations sorted map<double,int>::reverse_iterator it; for (i = 0; i < M; i++){ for (j = 0; j < N; j++){ xind = xindex(i,j); yind = yindex(j); violation = lpres.x()[xind]-(demand[i]*lpres.x()[yind]); if (violation > tolerance){ cut_v.push_back(make_pair(i,j)); cut_violation.insert(make_pair(violation,cutindex++)); } } }

Developing an Application 37 UFL: Constructing Cuts Next, we pass the most violated cuts back to BCP. //Add the xxx most violated ones. maxcuts = min((int)cut_v.size(), lp_par.entry(ufl_lp_par::ufl_maxcuts_iteration)); it = cut_violation.rbegin(); while(newcuts<maxcuts){ cutindex = it->second; violation = it->first; new_cuts.push_back(new UFL_cut(cut_v[cutindex].first, cut_v[cutindex].second)); newcuts++; it++; }

void UFL_lp::cuts_to_rows(const BCP_vec<BCP_var*>& vars, BCP_vec<BCP_cut*>& cuts, BCP_vec<BCP_row*>& rows, const BCP_lp_result& lpres, BCP_object_origin origin, bool allow_multiple){ const int cutnum = cuts.size(); rows.reserve(cutnum); for (int c = 0; c < cutnum; ++c) { UFL_cut* mcut = dynamic_cast<const UFL_cut*>(cuts[c]); if (mcut!= 0){ CoinPackedVector cut; cut.insert(xindex(mcut->i,mcut->j), 1.0); cut.insert(yindex(mcut->j), -1.0 * demand[mcut->i]); rows.push_back(new BCP_row(cut,-1.0 * INF, 0.0)); } } } Developing an Application 38 UFL: Adding Cuts to the LP Here is the cuts to rows function that actually generates the rows to be added to the LP relaxation.

Developing an Application 39 Resources Documentation There is a user s manual for BCP, but it is out of date. The most current documentation is in the source code don t be afraid to use it. Other resources There are several mailing lists on which to post questions and we make an effort to answer quickly. Also, there is a lot of good info at www.coin-or.org. There are some basic tutorials and other information, including the example you saw today at sagan.ie.lehigh.edu/coin/. There is a user s meeting Monday at 12:00 in International Ballroom A. There are three other sessions revolving around COIN software, including a tutorial on OSI.

Developing an Application 40 Final advice Use the source, Luke......and feel free to ask questions either by email or on the discussion list.