Package Rcplex. June 12, 2016

Similar documents
Package Rcplex. February 15, 2013

Package Rglpk. May 18, 2017

Package lpsymphony. February 6, 2018

Package Rcsdp. April 25, 2016

Package ROI.plugin.lpsolve

Package quadprogxt. February 4, 2018

Package ECOSolveR. February 18, 2018

cplexapi Quick Start

lpsymphony - Integer Linear Programming in R

Package ompr. November 18, 2017

AIMMS Function Reference - GMPInstance Procedures and Functions

Package rmatio. July 28, 2017

Package qap. February 27, Index 5. Solve Quadratic Assignment Problems (QAP)

ILOG CPLEX 10.0 Interactive Optimizer January 2006

IBM ILOG CPLEX Optimization Studio CPLEX Parameters Reference. Version 12 Release 7 IBM

The Ascendance of the Dual Simplex Method: A Geometric View

Linear and Integer Programming :Algorithms in the Real World. Related Optimization Problems. How important is optimization?

Welcome to the Webinar. Gurobi Enhancements to MATLAB and R

Motivation for Heuristics

The MIP-Solving-Framework SCIP

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

What's New In Gurobi 5.0. Dr. Edward Rothberg

Gurobi Guidelines for Numerical Issues February 2017

Math Models of OR: The Simplex Algorithm: Practical Considerations

Package mixsqp. November 14, 2018

Integer Programming Chapter 9

Welcome to the Webinar. What s New in Gurobi 7.5

3 INTEGER LINEAR PROGRAMMING

Package slam. February 15, 2013

Package clustering.sc.dp

SCIP. 1 Introduction. 2 Model requirements. Contents. Stefan Vigerske, Humboldt University Berlin, Germany

Package ECctmc. May 1, 2018

MATLAB Solution of Linear Programming Problems

GUROBI 1 GUROBI Installation 2 GUROBI Using the Matlab Interface 3 GUROBI Features 4 GUROBI Appendix A 5 GUROBI Appendix B 13 GUROBI Appendix C 19

Fundamentals of Integer Programming

Package slam. December 1, 2016

Package DSL. July 3, 2015

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

Package Rsolnp. R topics documented: January 8, Type Package. Title General Non-linear Optimization. Version

Contents. I Basics 1. Copyright by SIAM. Unauthorized reproduction of this article is prohibited.

An Extension of the Multicut L-Shaped Method. INEN Large-Scale Stochastic Optimization Semester project. Svyatoslav Trukhanov

Introduction to CPLEX. Some very convenient solvers for most students include those with Excel and Matlab.

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

NEOS.jl (and other things)

Package deductive. June 2, 2017

Package assortnet. January 18, 2016

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

Package hiernet. March 18, 2018

Package frt. R topics documented: February 19, 2015

Advanced Use of GAMS Solver Links

Package optisolve. R topics documented: July 28, 2017

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

Package ROI. January 26, 2018

9.4 SOME CHARACTERISTICS OF INTEGER PROGRAMS A SAMPLE PROBLEM

A Simplex Based Parametric Programming Method for the Large Linear Programming Problem

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

Topics. Introduction. Specific tuning/troubleshooting topics "It crashed" Gurobi parameters The tuning tool. LP tuning. MIP tuning

Column Generation: Cutting Stock

The Decomposition Algorithm

Discrete Optimization with Decision Diagrams

Towards Efficient Higher-Order Semidefinite Relaxations for Max-Cut

Package fastdummies. January 8, 2018

Applied Mixed Integer Programming: Beyond 'The Optimum'

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

Using IBM CPLEX Optimization Studio with MathWorks MATLAB

Package inca. February 13, 2018

Package lpsolveapi. February 15, 2013

The lpsolve Package. June 14, lp.assign... 1 lp.object... 3 lp... 3 lp.transport... 5 print.lp Index 8

Package sparsehessianfd

Package jdx. R topics documented: January 9, Type Package Title 'Java' Data Exchange for 'R' and 'rjava'

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

Package filematrix. R topics documented: February 27, Type Package

How to use your favorite MIP Solver: modeling, solving, cannibalizing. Andrea Lodi University of Bologna, Italy

Approximation Algorithms

Package spark. July 21, 2017

Package SAENET. June 4, 2015

ILOG CPLEX 10.0 File Formats

Linear & Integer Programming: A Decade of Computation

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

SAS/OR 14.1 User s Guide: Mathematical Programming. The Mixed Integer Linear Programming Solver

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

Appendix A MATLAB s Optimization Toolbox Algorithms

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

Package svd. R topics documented: September 26, 2017

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

Package Combine. R topics documented: September 4, Type Package Title Game-Theoretic Probability Combination Version 1.

Pivot and Gomory Cut. A MIP Feasibility Heuristic NSERC

Package cattonum. R topics documented: May 2, Type Package Version Title Encode Categorical Features

The Gurobi Optimizer. Bob Bixby

Linear programming and duality theory

Crash-Starting the Simplex Method

Package xwf. July 12, 2018

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

Package SPIn. R topics documented: February 19, Type Package

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

INTRODUCTION TO LINEAR AND NONLINEAR PROGRAMMING

Package CatEncoders. March 8, 2017

6 Randomized rounding of semidefinite programs

Package dotcall64. January 11, 2018

Package OLScurve. August 29, 2016

Transcription:

Version 0.3-3 Date 2016-06-09 Title R Interface to CPLEX Package Rcplex June 12, 2016 Description R interface to CPLEX solvers for linear, quadratic, and (linear and quadratic) mixed integer programs. Support for quadratically constrained programming is available. See the file ``IN- STALL'' for details on how to install the Rcplex package in Linux/Unix-like and Windows systems. Support for sparse matrices is provided by an S3-style class ``simple_triplet_matrix'' from package slam and by objects from the Matrix package class hierarchy. LazyLoad yes Depends R (>= 2.6.0), slam Imports methods Enhances Matrix SystemRequirements IBM ILOG CPLEX libraries and headers License LGPL (>= 2.0) URL http://r-forge.r-project.org/projects/rcplex NeedsCompilation yes Author Hector Corrada Bravo [aut], Kurt Hornik [ctb], Stefan Theussl [aut, cre] Maintainer Stefan Theussl <Stefan.Theussl@R-project.org> Repository CRAN Date/Publication 2016-06-12 19:03:03 R topics documented: Rcplex............................................ 2 Rcplex.close......................................... 6 Rcplex_solve_QCP..................................... 7 Index 10 1

2 Rcplex Rcplex Solve optimization problem with CPLEX Description Interface to CPLEX solvers for linear quadratic and (linear or quadratic) mixed-integer programs. The general statement of the problem is min 1 2 x Qx + c x s.tax b lb x ub If Q==NULL then the problem is linear, if any value of the vtype argument is "B" or "I" then the problem is a mixed-integer program. The control argument is used to set CPLEX s many parameters. See details. The objsense determines if the problem is a maximization or minimization problem. The sense argument is used to set the constraint directions. Usage Rcplex(cvec, Amat, bvec, Qmat = NULL, lb = 0, ub = Inf, control = list(), objsense = c("min", "max"), sense = "L", vtype = NULL, n = 1) Arguments cvec Amat bvec Qmat lb ub control objsense sense The linear coefficient of the objective function The constraint matrix (requires ncol(amat)==length(cvec)) The constraints right-hand side (requires length(bvec)==nrow(amat)) The quadratic coefficient of the objective function. If NULL the problem is linear. If not NULL, it must be a symmetric positive semidefinite matrix of size length(cvec) by length(cvec). Default NULL Lower bound on the problem variables. If length(lb)==1 then lb is the lower bound of all variables. Otherwise, length(lb)==length(cvec). Set lb=-inf to have no lower bound. Default 0. Upper bound on the problem variables. See lb for further details. Default Inf. A list of CPLEX parameters. See *Details* Either "max" or "min", determines the optimization direction. Default "min" The direction of the inequality in each constraint. If length(sense)==1 then the same value is taken for each constraint. Can be one of "L" (less than or equal), "G" (reater than or equal) or "E" (equal). Requires length(sense)==length(bvec). Default "L".

Rcplex 3 vtype n Determines the type of each problem variable. Can be one of "C" (continuous), "I" (integer) or "B" (binary). If length(vtype)==1 the same value is taken for all variables. Otherwise, requires length(vtype)==length(ctype). Default "C". Determines the maximal number of solutions the solver should return in case of an MIP with more than one solution at optimum. If CPLEX should search for "all" solutions then n has to be set to NA. In CPLEX this is also called populating the solution pool. The parameters solnpoolagap, solnpoolgap, and solnpoolintensity influence the search for multiple solutions (see also the control argument below for details). Available from CPLEX 11.0 on. Rcplex() raises a warning if an older version of CPLEX is used and n>1. Default 1. Details Matrices A and C may be sparse matrices from a class in the hierarchy defined by the Matrix package. In that case, the internal casting functions are used to create the proper data structures to pass to CPLEX, which is similar to the column-major storage mode defined by the dgcmatrix-class defined by the Matrix package. We also provide a simple S3-style class for sparse matrices simple_triplet_matrix, as used in the relations package. Matrices A and C can be objects of this class. See the examples for example usage. simple_triplet_matrix objects MUST be in column-major order. The control argument can be used to set CPLEX s many parameters, including the particular algorithm used for solving the given problem. See the ILOG CPLEX Parameters guide for further details. The following parameters are supported: trace: Turn CPLEX output on (1) or off(0). Default 1. maxcalls: Number of calls to the CPLEX optimizer before license is released. Set to 1 to get a new license on every call to Rcplex. Can be any positive number. Default 500. method: Algorithm to use (Default 0): 0: Automatic: CPLEX chooses algorithm automatically 1: Primal Simplex 2: Dual Simplex 3: Network Simplex 4: Barrier preind: Turn presolver on (1) or off (0). Default 1. aggind: Limit on the number of applications of the aggregator. Possible Values: -1 (automatic), 0 (do not use), any positive integer itlim: Maximum number of simplex iterations. Can be any nonnegative number. Default 1e8. epagap: Absolute MIP optimality gap tolerance. Can be any nonnegative number. Default 1e-6. epgap: Relative MIP optimality gap tolerance. Can be any nonnegative number. Default 1e-4. tilim: Time limit in seconds of call to optimizer. Can be any nonnegative number. Default 1e75. disjcuts: Indicator for disjunctive cuts used in MIP solver. Must be in -1:3. Default 0 (automatic).

4 Rcplex mipemphasis: Indicator for MIP solver emphasis. Must be in 0:4. Default 0 (balance optimality and feasibility) cliques: Indicator for clique cuts in MIP solver. Must be in -1:2. Default 0 (automatic) nodesel: Node selection strategy in MIP solver. Must be in 0:3. Default 1 (best-bound search). probe: Probe level in MPI solver. Must be -1:3. Default 0 (automatic) varsel: Variable selection strategy in MIP solver. Must be in -1:4. Default 0 (choose best method automatically). flowcovers: Indicator for flowcover cuts in MIP solver. Must be in -1:2. Default 0 (automatic). solnpoolagap: Sets an absolute tolerance on the objective value for the solutions in the solution pool. Can be any nonnegative real number. Ignored in versions < 11.0 of CPLEX. Default 0 solnpoolgap: Sets a relative tolerance on the objective value for the solutions in the solution pool. Can be any nonnegative real number. Ignored in versions < 11.0 of CPLEX. Default 0 solnpoolintensity: Controls the trade-off between the number of solutions generated for the solution pool and the amount of time and memory consumed. Must be in 0:4. Ignored in versions < 11.0 of CPLEX. Default 0 (automatic). round: Flag indicating if integer solutions for MIPs should be rounded before returning. In some cases, CPLEX returns slightly infeasible integer solutions. Setting this option to 1 ensures that the returned solution is integral by rounding. Default 0 (no rounding). Value Returns a list with the following components, or, if n > 1 a list of length equal to the number of optimal solutions containing the following components for each solution: xopt obj status extra Values of problem variables at optimum. Value of objective function at optimum. Solution status. See CPLEX documentation for meaning of status codes. List with extra information about solution with components slack: Values of slack variables for inequality constraints. nodecnt: (IF MIP PROBLEM) Number of nodes in the search tree evaluated lambda: (IF NOT MIP PROBLEM) Values of dual variables at optimum Author(s) Hector Corrada Bravo and Stefan Theussl References IBM ILOG CPLEX Optimization Studio documentation See Also Rcplex.close, optim

Rcplex 5 Examples ## A linear program (this is lpex1.c in the CPLEX examples) cvec <- c(1,2,3) Amat <- matrix(c(-1,1,1,-1,3,-1),byrow=true,nc=3) bvec <- c(20,-30) ub <- c(40,inf,inf) res <- Rcplex(cvec,Amat,bvec,ub=ub,objsense="max",sense=c('L','G')) ## A linear program with random data ## use the barrier method n = 20; m = 25 nnz <- trunc(.2 * m * n) ## entries in simple_triplet_matrix clas ## *must* be in column major order nnz <- sort(sample(m*n,nnz,replace=false)-1) Amat <- simple_triplet_matrix( i = (nnz %% m) + 1, j = trunc(nnz/m) + 1, v = rnorm(nnz), nrow=m,ncol=n) x0 <- runif(n) b <- as.matrix(amat) %*% x0 cvec <- rnorm(n) res <- Rcplex(cvec,Amat,b,sense='E',control=list(method=4)) ## A quadratic problem (this is qpex1.c in the CPLEX examples) cvec <- c(1,2,3) Qmat <- matrix(c(-33,6,0, 6,-22,11.5, 0,11.5,-11), byrow=true, nc=3) Amat <- matrix(c(-1,1,1, 1,-3,1), byrow=true,nc=3) bvec <- c(20,30) ub <- c(40,inf,inf) res <- Rcplex(cvec,Amat,bvec,Qmat,ub=ub,objsense="max") ## A mixed integer linear program (mipex1.c in the CPLEX examples) cvec <- c(1,2,3,1) Amat <- matrix(c(-1,1,1,10, 1,-3,1,0, 0,1,0,-3.5),

6 Rcplex.close byrow=true, nc=4) bvec <- c(20,30,0) lb <- c(0,0,0,2) ub <- c(40,inf,inf,3) vtype <- c(rep("c",3),"i") res <- Rcplex(cvec,Amat,bvec,lb=lb,ub=ub,sense=c("L","L","E"), objsense="max",vtype=vtype) ## A mixed integer quadratic program cvec <- c(1,2,3,1) Qmat <- matrix(c(-33,6,0,0, 6,-22,11.5,0, 0,11.5,-11,0, 0,0,0,0), byrow=true, nc=4) Amat <- matrix(c(-1,1,1,10, 1,-3,1,0, 0,1,0,-3.5), byrow=true, nc=4) bvec <- c(20,30,0) ub <- c(40,inf,inf,3) vtype <- c(rep("c",3),"i") res <- Rcplex(cvec,Amat,bvec,Qmat=Qmat,ub=ub,sense=c("L","L","E"), objsense="max",vtype=vtype) Rcplex.close() Rcplex.close Release CPLEX license Description This function releases the currently held CPLEX license. Usage Rcplex.close() Author(s) Hector Corrada Bravo See Also Rcplex

Rcplex_solve_QCP 7 Rcplex_solve_QCP Solve quadratically constrained optimization problem with CPLEX Description Usage Interface to CPLEX solvers for quadratically constrained linear, quadratic, and mixed-integer programs. The general statement of the problem is min 1 2 x Qx + c x s.tax b anda ix + x Q i x r i fori = 1,..., q lb x ub If Q==NULL then the problem is linear, if any value of the vtype argument is "B" or "I" then the problem is a mixed-integer program. The control argument is used to set CPLEX s many parameters. See details. The objsense determines if the problem is a maximization or minimization problem. The sense argument is used to set the constraint directions. Rcplex_solve_QCP(cvec, Amat, bvec, Qmat = NULL, QC, lb = 0, ub = Inf, sense = "L", objsense = c("min", "max"), vtype = NULL, n = 1, control = list()) Arguments cvec Amat bvec Qmat QC lb ub control objsense The linear coefficient of the objective function The constraint matrix (requires ncol(amat)==length(cvec)) The constraints right-hand side (requires length(bvec)==nrow(amat)) The quadratic coefficient of the objective function. If NULL the problem is linear. If not NULL, it must be a symmetric positive semidefinite matrix of size length(cvec) by length(cvec). Default NULL a list with three elements: QC, dir, and b. The element QC is a list with the quadratic part Q, a matrix, and the linear part of the constraint L, a numeric (currently nonzero values are not supported). dir has the same meaning as argument sense and b as bvec. Lower bound on the problem variables. If length(lb)==1 then lb is the lower bound of all variables. Otherwise, length(lb)==length(cvec). Set lb=-inf to have no lower bound. Default 0. Upper bound on the problem variables. See lb for further details. Default Inf. A list of CPLEX parameters. See *Details* Either "max" or "min", determines the optimization direction. Default "min"

8 Rcplex_solve_QCP sense vtype n The direction of the inequality in each constraint. If length(sense)==1 then the same value is taken for each constraint. Can be one of "L" (less than or equal), "G" (reater than or equal) or "E" (equal). Requires length(sense)==length(bvec). Default "L". Determines the type of each problem variable. Can be one of "C" (continuous), "I" (integer) or "B" (binary). If length(vtype)==1 the same value is taken for all variables. Otherwise, requires length(vtype)==length(ctype). Default "C". Determines the maximal number of solutions the solver should return in case of an MIP with more than one solution at optimum. If CPLEX should search for "all" solutions then n has to be set to NA. In CPLEX this is also called populating the solution pool. The parameters solnpoolagap, solnpoolgap, and solnpoolintensity influence the search for multiple solutions (see also the control argument below for details). Available from CPLEX 11.0 on. Rcplex() raises a warning if an older version of CPLEX is used and n>1. Default 1. Details See function link[rcplex]{rcplex}() for more information about sparse matrix representation and control arguments. Value Returns a list with the following components, or, if n > 1 a list of length equal to the number of optimal solutions containing the following components for each solution: xopt obj status extra Values of problem variables at optimum. Value of objective function at optimum. Solution status. See CPLEX documentation for meaning of status codes. List with extra information about solution with components slack: Values of slack variables for inequality constraints. nodecnt: (IF MIP PROBLEM) Number of nodes in the search tree evaluated lambda: (IF NOT MIP PROBLEM) Values of dual variables at optimum Author(s) Hector Corrada Bravo and Stefan Theussl References IBM ILOG CPLEX Optimization Studio documentation See Also Rcplex.close, optim

Rcplex_solve_QCP 9 Examples ## objective function c <- c(1, 2, 3) Q <- matrix(c(-33, 6, 0, 6, -22, 11.5, 0, 11.5, -11), nrow = 3) ## constraints ## linear part A <- matrix(c(-1, 1, 1, -3, 1, 1), nrow = 2) dir <- c("l", "L") b <- c(20, 30) ## quadratic part QC <- list(qc = list(q = list(diag(1, nrow = 3)), L = NULL), dir = "L", b = 1) ## bounds ub <- c(40, Inf, Inf) ## solve res <- Rcplex_solve_QCP(c,A, b, Q, ub = ub, QC = QC, sense = dir, objsense = "max") ## solve MIQCP res <- Rcplex_solve_QCP(c, A, b, Q, ub = ub, QC = QC, sense = dir, objsense = "max", vtype = c("c", "I", "C")) ## quadratic and linear part QC <- list(qc = list(q = list(diag(1, nrow = 3)), L = list(c(3,4,-3))), dir = "L", b = 1) ## solve res <- Rcplex_solve_QCP(c,A, b, Q, ub = ub, QC = QC, sense = dir, objsense = "max") Rcplex.close()

Index Topic optimize Rcplex, 2 Rcplex_solve_QCP, 7 Topic utilities Rcplex.close, 6 optim, 4, 8 Rcplex, 2, 6 Rcplex.close, 4, 6, 8 Rcplex_solve_QCP, 7 10