sbb COIN-OR Simple Branch-and-Cut

Similar documents
sbb COIN-OR Simple Branch-and-Cut

Using COIN-OR to Solve the Uncapacitated Facility Location Problem

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

Source Code Not Required: Using the COIN-OR Binaries

The SYMPHONY Callable Library for Mixed-Integer Linear Programming

COIN-OR: Software Tools for Implementing Custom Solvers

Hello, World! in C. Johann Myrkraverk Oskarsson October 23, The Quintessential Example Program 1. I Printing Text 2. II The Main Function 3

Integer Programming Chapter 9

Experience with CGL in the PICO Mixed- Integer Programming Solver

Lab 1: First Steps in C++ - Eclipse

COSC 2P91. Introduction Part Deux. Week 1b. Brock University. Brock University (Week 1b) Introduction Part Deux 1 / 14

An Open Source Solver for Bicriteria Mixed Integer Programs

Short Notes of CS201

CS201 - Introduction to Programming Glossary By

Exercise 1.1 Hello world

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

My First Command-Line Program

Chapter 11 Introduction to Programming in C

Reviewing gcc, make, gdb, and Linux Editors 1

Chapter 8. The incremental linker

Modeling with COIN-OR Tools

TIM 206 Lecture Notes Integer Programming

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

QUIZ. What is wrong with this code that uses default arguments?

CpSc 1010, Fall 2014 Lab 10: Command-Line Parameters (Week of 10/27/2014)

Tutorial 1 C Tutorial: Pointers, Strings, Exec

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

3 INTEGER LINEAR PROGRAMMING

Separate Compilation of Multi-File Programs

Multimedia-Programmierung Übung 3

Programming the DMCC in C

Fundamentals of Integer Programming

Exercise Session 2 Systems Programming and Computer Architecture

Chapter 11 Introduction to Programming in C

Computer Science 322 Operating Systems Mount Holyoke College Spring Topic Notes: C and Unix Overview

15-780: Problem Set #2

CSC258: Computer Organization. Functions and the Compiler Tool Chain

CS 361 Computer Systems Fall 2017 Homework Assignment 1 Linking - From Source Code to Executable Binary

Chapter 11 Introduction to Programming in C

CAAM 420 Daily Note. Scriber: Qijia Jiang. Date: Oct.16. Project 3 Due Wed 23.Oct. Two parts: debug code and library exercise.

The SYMPHONY Callable Library for Mixed-Integer Linear Programming

Software Development With Emacs: The Edit-Compile-Debug Cycle

CS 110 Computer Architecture. Lecture 2: Introduction to C, Part I. Instructor: Sören Schwertfeger.

lpsymphony - Integer Linear Programming in R

Mobile Location Protocol

Motivation was to facilitate development of systems software, especially OS development.

Download, Install and Setup the Linux Development Workload Create a New Linux Project Configure a Linux Project Configure a Linux CMake Project

How to cross compile with LLVM based tools. Peter Smith, Linaro

CSE 374 Programming Concepts & Tools

Starting to Program in C++ (Basics & I/O)

Chapter 11 Introduction to Programming in C

y

Computer Networks. Project 3. Project Assigned: December 2 Due: December 17 12:01 AM Show and Tell: December Networks - Project 3 1

Obtained the source code to gcc, one can just follow the instructions given in the INSTALL file for GCC.

PIC 10A Objects/Classes

Operator overloading

CS4961 Parallel Programming. Lecture 16: Introduction to Message Passing 11/3/11. Administrative. Mary Hall November 3, 2011.

Lab: Supplying Inputs to Programs

Minimum Weight Constrained Forest Problems. Problem Definition

Your first C and C++ programs

Professor Terje Haukaas University of British Columbia, Vancouver C++ Programming

HW3a solution. L1 implies there must be an f1 in Base L2 implies there must be an f2 in Base. So we know there is an f1 and f2 in Base

OpenFOAM directory organization

MIPS Functions and Instruction Formats

Lecture Notes on Contracts

C++ Lab 03 - C++ Functions

CS 61C: Great Ideas in Computer Architecture Lecture 2: Introduction to C, Part I

Motivation was to facilitate development of systems software, especially OS development.

G52CPP C++ Programming Lecture 3. Dr Jason Atkin

FUNCTIONS POINTERS. Pointers. Functions

CS354 gdb Tutorial Written by Chris Feilbach

82V391x / 8V893xx WAN PLL Device Families Device Driver User s Guide

377 Student Guide to C++

Chapter - 7 The Programming Process. Practical C++ Programming Copyright 2003 O'Reilly and Associates Page1

CSE 374 Programming Concepts & Tools. Hal Perkins Fall 2015 Lecture 19 Introduction to C++

Chapter 11 Introduction to Programming in C

Computational Physics Operating systems

PROGRAMMING IN C++ CVIČENÍ

PRINCIPLES OF OPERATING SYSTEMS

Computer Science 2500 Computer Organization Rensselaer Polytechnic Institute Spring Topic Notes: C and Unix Overview

Message Passing Interface (MPI)

Initializing and Finalizing Objects

System calls and assembler

Common Misunderstandings from Exam 1 Material

CSE 333 Final Exam June 6, 2017 Sample Solution

C:\Temp\Templates. Download This PDF From The Web Site

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

CS 220: Introduction to Parallel Computing. Beginning C. Lecture 2

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

CS 403: Lab 6: Profiling and Tuning

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

CS 110 Computer Architecture. Lecture 2: Introduction to C, Part I. Instructor: Sören Schwertfeger.

Programming in C. Pointers and Arrays

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

Concepts Introduced in Chapter 3

SE350: Operating Systems

Basic program The following is a basic program in C++; Basic C++ Source Code Compiler Object Code Linker (with libraries) Executable

Introduction to OpenMP

oascript & oadebug Kevin Nesmith Lead Engineer, Si2 June 7, 2013

Pointers in C/C++ 1 Memory Addresses 2

Transcription:

sbb COIN-OR Simple Branch-and-Cut Additional Notes for sbb COIN-OR Tutorial CORS/INFORMS Joint Meeting, Banff, May, 2004 Lou Hafer Computing Science Simon Fraser University May 14, 2004 The material on these pages augments the tutorial slides and provides some pointers to additional resources. 1 Branching Concepts A branching object has: One or more feasible regions. For a binary variable, the feasible regions would be the values 0 and 1. For a general integer variable, the feasibile regions would be all integer values between the lower and upper bounds. For a set of binary variables forming a clique, it would be an assignment of values to the variables such that exactly one variable had the value 1 and all others were 0. A way to evaluate the infeasibility of a solution. For an integer variable x with value x in the optimal solution to a relaxation, the infeasibility is usually defined as max(x x, x x ). Sbb adopts the convention that the infeasibility of a branching object should be scaled to the range [0,.5] so that infeasibility can be compared between different branching objects. Some set of branching actions which, when executed, will force the relaxation closer to feasibility. These are the actions taken to restrict a relaxation. For an integer variable, the common branching actions for a standard two-way branch are 1

to tighten the upper bound to x in one branch and the lower bound to x in the other. For a clique of size k, the branch would be k-ary, with one member variable set to 1 in each branch. A method to rank the desireability of a branch alternative vs. other branching alternatives, so that it s possible to specify a preferred branching direction. This is in the context of a single branching object. A general integer branching object might use reduced costs to estimate the cost of forcing x = x to x vs. x. 2 Customizing Sbb If you plan on developing custom methods for branching or node selection, you should do make doc to extract the documentation embedded in the code and format it as HTML files (cf. 4). Read the detailed descriptions (the link labelled More... ) for the top level classes; this is the single best source of conceptual overview information about Sbb 1. The detailed descriptions for SbbObject and SbbCompareBase provide the overview information presented in the tutorial. Additional details are provided in the documentation for the derived classes and their member functions. 1 And OSI, and many of the specific solver interfaces. Hey, if you re doing serious development, you re going to have to read at least some of the code in any event. Make your life easy and start with the embedded documentation. 2

3 A Minimal Branch-and-Bound Example Here s a listing of the file dsbbclp.cpp, a minimal branch-and-bound solver, with comments. This version uses the clp lp solver. /* dsbb: dead simple branch-and-bound A *really* minimal example of using the sbb library. */ #include <iostream> #include "OsiSolverInterface.hpp" #define COIN_USE_CLP #include "OsiClpSolverInterface.hpp" #include "SbbModel.hpp" /* Here are the basic steps you need to perform in order to solve a MIP: Step 1: Make a solver interface. Step 2: Create a model. The solver interface is held as an attribute of the model. Step 3: Load a problem. Here I ve used the solver s readmps() routine. You can also build the problem from scratch using other OSI solver interface routines. Step 4: Invoke the solver to do the initial optimization. Step 5: Perform branch-and-bound search. Step 6: Extract the solution. The code here just checks that a solution was found and prints the objective. */ If you want to use cut generators, heuristics, or otherwise tweak the search, the code would be interleaved with steps 2, 3, and 4. There are more complex examples in the COIN/Sbb directory tree. int main (int argc, const char *argv[]) { OsiSolverInterface *osi = new OsiClpSolverInterface ; // Step 1 SbbModel *model = new SbbModel(*osi) ; // Step 2 model->solver()->readmps("p0033") ; // Step 3 model->initialsolve() ; // Step 4 model->branchandbound() ; // Step 5 if (model->bestsolution()) // Step 6 { std::cout << "Best solution " << model->solver()->getobjvalue() << std::endl ; return (0) ; } else { std::cout << "No integer solution found." << std::endl ; return (1) ; } } 3

The above file is part of an example that can be found in the COIN distribution in the directory Examples/Sbb. The example also includes dsbbdylp.cpp, an alternate version which uses the dylp solver, and a makefile, Makefile.dsbb. These are described in a bit more detail below. The file dsbbdylp.cpp shows the changes that are required to use a different OSI solver, dylp. There are two: The solver-specific #include file must be changed from #define COIN_USE_CLP #include "OsiClpSolverInterface.hpp" to #define COIN_USE_DYLP #include "OsiDylpSolverInterface.hpp" The compile-time symbols COIN USE CLP and COIN USE DYLP are used in the context of the full COIN-OR library to control inclusion of solver specific code. Normally they would be part of a makefile or equivalent build control file. To keep the example and its accompanying makefile as simple as possible, the symbol is hardcoded here. The solver-specific constructor must be changed from OsiSolverInterface *osi = new OsiClpSolverInterface ; to OsiSolverInterface *osi = new OsiDylpSolverInterface ; 4

Here s a slightly abridged listing for Makefile.dsbb, with comments. # Dead simple makefile for dead simple branch-and-bound (dsbb) # So that standard makefile tricks do not obscure the necessary actions, # this file is hardwired for locations and programming environment. # Standard locations for COIN libraries and include files. Edit if you ve # installed COIN somewhere else. COINHOME := $(HOME)/COIN COININC := $(COINHOME)/include COINLIB := $(COINHOME)/lib # You only need these to build dsbbdylp with the dylp solver, one of the # alternative solvers with COIN/OSI interfaces. DYLPHOME := $(HOME)/Bonsai/OsiDylp DYLPINC := $(HOME)/Bonsai/OsiDylp DYLPLIB := $(HOME)/Libraries/DylpLib DYLPLIBINC := $(HOME)/Libraries/DylpLib # In the Sun Solaris/Workshop environment, CC is the name of the C++ # compiler. Change to suit your environment (g++ if you use GCC under # Solaris or Linux). # -R is the flag that tells the Solaris linker to add a directory # to the run-time library search path. Change to suit your environment # (for GCC, use -Wl,-R under Solaris, -Wl,-rpath under Linux) dsbbdylp: dsbbdylp.cpp CC -I$(COININC) -I$(DYLPINC) -I$(DYLPLIBINC) \ -L$(COINLIB) -lsbb -losidylp -losiclp -losi -lcoin -lclp -lcgl \ -L$(DYLPHOME) -losidylpsolver.sparc \ -L$(DYLPLIB) -ldylpstd.sparc \ -lz \ -R$(COINLIB) -R$(DYLPHOME) -R$(DYLPLIB) \ -o dsbbdylp dsbbdylp.cpp # The clp link requires only components from the COIN software distribution. dsbbclp: dsbbclp.cpp CC -I$(COININC) \ -L$(COINLIB) -lsbb -losiclp -losi -lcoin -lclp -lcgl \ -lz \ -R$(COINLIB) -R$(DYLPLIB) \ -o dsbbclp dsbbclp.cpp 5

As the makefile comments state, the reason for including the clp library (-lclp) in the link step for dsbbdylp is that in my environment both solvers are enabled. Also, COIN makefiles will enable clp by default. For efficiency, sbb includes a few pieces of code which are specialized for clp. Rather than rebuild the sbb library without clp just for this example, I chose the easy solution and added the clp library to the link. Similarly, sbb is a branch-and-cut code, and support for cutting planes is built in by default. The Cgl library is needed to satisfy the references, even though the code will not be executed unless cut generators and/or heuristics are actually installed. 4 Resources Specifically for sbb, be sure to consider: The documentation embedded in the code. Typing make doc in the Sbb directory of the COIN-OR distribution will use doxygen to extract embedded documentation, format it in HTML, and store it in a subdirectory named Doc. Point your browser to the file Doc/html/index.html. If you don t have doxygen installed on your system, check the doxygen web site, http://www.stack.nl/ dimitri/doxygen. The samples included with the distribution, in the Sbb/Samples directory. The following are general resoources for COIN-OR: COIN-OR website: www.coin-or.org COIN-OR tutorials site: http://sagan.ie.lehigh.edu/coin/ The following are on-line resources for C++: C++ Annotations by Frank B. Brokken. In the author s words,... intended for knowledgeable users of C who would like 2 to make the transition to C++. http://www.icce.rug.nl/documents/cplusplus C/C++ Reference by Nate Kohl. Strictly reference, but comprehensive. http://www.cppreference.com/ 2 And just as useful if you re being dragged kicking and screaming out of your nice, comfy C environment into the wholly incomprehensible world of C++. 6