the r to mosek optimization interface
play

The R-to-MOSEK Optimization Interface Henrik Alsing Friberg MOSEK - PowerPoint PPT Presentation

The R-to-MOSEK Optimization Interface Henrik Alsing Friberg MOSEK ApS, Fruebjergvej 3, Box 16, DK 2100 Copenhagen, Blog: http://themosekblog.blogspot.com ISMP, Berlin 2012 http://www.mosek.com Introduction 2 / 48 What is R? Introduction


  1. The R-to-MOSEK Optimization Interface Henrik Alsing Friberg MOSEK ApS, Fruebjergvej 3, Box 16, DK 2100 Copenhagen, Blog: http://themosekblog.blogspot.com ISMP, Berlin 2012 http://www.mosek.com

  2. Introduction 2 / 48

  3. What is R? Introduction The R Project What is R? What is MOSEK? A fast open-source programming language for What is Rmosek? Installation technical computing and graphics. Simple models Advanced models Highlights: Better formulations Data handling and visualization ■ One million users – Intel Capital, 2009 High performance Summary ■ The Comprehensive R Archive Network (3895 packages and counting) ■ Direct interfaces to C and Fortran (as well as C++, Perl, Java, Python, Matlab, Excel etc.) ■ Revolution Analytics ■ RStudio 3 / 48

  4. What is MOSEK? Introduction MOSEK What is R? What is MOSEK? A high performance software library designed to What is Rmosek? Installation solve large-scale convex optimization problems. Simple models Advanced models Highlights: Better formulations Data handling and visualization ■ Linear constraints (LP) High performance Summary ■ Second-order cone constraints (SOCP) ■ Semidefinite constraints (SDP) ■ Mixed-integer variables (MIP) ■ Quadratic terms (QP and QCQP) ■ Separable convex operators – log( x i ) , exp( x i ) , ... 4 / 48

  5. What is Rmosek? Introduction Rmosek What is R? What is MOSEK? A simple interface from R to the optimizers of What is Rmosek? Installation MOSEK. Simple models Advanced models Why? Better formulations Data handling and visualization ■ Some financial customers find R better than MATLAB. High performance Summary ■ Replace unofficial implementations. 5 / 48

  6. What is Rmosek? Introduction Rmosek What is R? What is MOSEK? A simple interface from R to the optimizers of What is Rmosek? Installation MOSEK. Simple models Advanced models Why? Better formulations Data handling and visualization ■ Some financial customers find R better than MATLAB. High performance Summary ■ Replace unofficial implementations. Goals: ■ Open-source ■ Highly effective ■ Integrate with what R users normally do 5 / 48

  7. Installation Introduction A oneliner for Windows, MacOS and Linux: What is R? install.packages("Rmosek", type="source") What is MOSEK? What is Rmosek? Installation Simple models Advanced models Better formulations Data handling and visualization High performance Summary 6 / 48

  8. Installation Introduction A oneliner for Windows, MacOS and Linux: What is R? install.packages("Rmosek", type="source") What is MOSEK? What is Rmosek? Installation Package overview: Simple models library(help="Rmosek") Advanced models Better formulations Data handling and Major functions: visualization High performance ■ mosek(prob) Summary ■ mosek write(prob, file) ■ mosek read(file) The problem is an R-variable.. Create as you like! 6 / 48

  9. Simple models 7 / 48

  10. Linear optimization Introduction Simple models maximize 3 x 1 + 1 x 2 + 5 x 3 + 1 x 4 Linear optimization 3 x 1 + 1 x 2 + 2 x 3 = 30 , subject to Advanced models 2 x 1 + 1 x 2 + 3 x 3 + 1 x 4 ≥ 15 , Better formulations 2 x 2 + 3 x 4 ≤ 25 , Data handling and visualization High performance 0 ≤ ≤ ∞ , x 1 Summary 0 ≤ ≤ 10 , x 2 0 ≤ x 3 ≤ ∞ , 0 ≤ x 4 ≤ ∞ . 8 / 48

  11. Linear optimization Introduction lo1 <- list() Simple models Linear optimization ## Objective Advanced models lo1$sense <- "max" Better formulations Data handling and lo1$c <- c(3, 1, 5, 1) visualization High performance ## Constraint matrix Summary lo1$A <- spMatrix(nrow = 3, ncol = 4, i = c(1, 2, 1, 2, 3, 1, 2, 2, 3), j = c(1, 1, 2, 2, 2, 3, 3, 4, 4), x = c(3, 2, 1, 1, 2, 2, 3, 1, 3) ) 9 / 48

  12. Linear optimization Introduction ## Constraint bounds Simple models lo1$bc <- cbind(c(30, 30), Linear optimization c(15, Inf), Advanced models c(-Inf, 25)) Better formulations Data handling and visualization ## Variable bounds High performance lo1$bx <- cbind(c(0, Inf), Summary c(0, 10), c(0, Inf), c(0, Inf)) 10 / 48

  13. Advanced models 11 / 48

  14. Second-order cone and semidefinite optimization   2 1 0 Introduction  • x 1 + x 1 1 2 1 minimize  Simple models 0 1 2 Advanced models   Second-order cone 1 0 0 and semidefinite  • x 1 + x 1 subject to 0 1 0 = 1 . 0 , optimization  Better formulations 0 0 1 Data handling and   1 1 1 visualization  • x 1 + x 2 + x 3 1 1 1 = 0 . 5 , High performance  1 1 1 Summary � ( x 1 , x 2 , x 3 ) ∈ R 3 , x 2 2 + x 2 x 1 ≥ x 1 � 0 . 3 , 12 / 48

  15. Second-order cone and semidefinite optimization   2 1 0 Introduction  • x 1 + x 1 1 2 1 minimize  Simple models 0 1 2 Advanced models   Second-order cone 1 0 0 and semidefinite  • x 1 + x 1 subject to 0 1 0 = 1 . 0 , optimization  Better formulations 0 0 1 Data handling and   1 1 1 visualization  • x 1 + x 2 + x 3 1 1 1 = 0 . 5 , High performance  1 1 1 Summary � ( x 1 , x 2 , x 3 ) ∈ R 3 , x 2 2 + x 2 x 1 ≥ x 1 � 0 . 3 , sdo1 <- list() sdo1$sense <- "minimize" sdo1$c <- c(1,0,0) 13 / 48

  16. Second-order cone and semidefinite optimization   2 1 0 Introduction  • x 1 + x 1 1 2 1 minimize  Simple models 0 1 2 Advanced models   Second-order cone 1 0 0 and semidefinite  • x 1 + x 1 subject to 0 1 0 = 1 . 0 , optimization  Better formulations 0 0 1 Data handling and   1 1 1 visualization  • x 1 + x 2 + x 3 1 1 1 = 0 . 5 , High performance  1 1 1 Summary � ( x 1 , x 2 , x 3 ) ∈ R 3 , x 2 2 + x 2 x 1 ≥ x 1 � 0 . 3 , sdo1$A <- spMatrix(nrow=2, ncol=3, i = c(1,2,2), j = c(1,2,3), x = c(1,1,1) ) 14 / 48

  17. Second-order cone and semidefinite optimization   2 1 0 Introduction  • x 1 + x 1 1 2 1 minimize  Simple models 0 1 2 Advanced models   Second-order cone 1 0 0 and semidefinite  • x 1 + x 1 subject to 0 1 0 = optimization 1 . 0 ,  Better formulations 0 0 1 Data handling and   1 1 1 visualization  • x 1 + x 2 + x 3 1 1 1 = 0 . 5 , High performance  1 1 1 Summary � ( x 1 , x 2 , x 3 ) ∈ R 3 , x 2 2 + x 2 x 1 ≥ x 1 � 0 . 3 , sdo1$bc <- cbind(c(1.0, 1.0), c(0.5, 0.5)) 15 / 48

  18. Second-order cone and semidefinite optimization   2 1 0 Introduction  • x 1 + x 1 1 2 1 minimize  Simple models 0 1 2 Advanced models   Second-order cone 1 0 0 and semidefinite  • x 1 + x 1 subject to 0 1 0 = 1 . 0 , optimization  Better formulations 0 0 1 Data handling and   1 1 1 visualization  • x 1 + x 2 + x 3 1 1 1 = 0 . 5 , High performance  1 1 1 Summary � ( x 1 , x 2 , x 3 ) ∈ R 3 , x 2 2 + x 2 x 1 ≥ x 1 � 0 . 3 , sdo1$bx <- cbind(c(-Inf, Inf), c(-Inf, Inf), c(-Inf, Inf)) 16 / 48

  19. Second-order cone and semidefinite optimization   2 1 0 Introduction  • x 1 + x 1 1 2 1 minimize  Simple models 0 1 2 Advanced models   Second-order cone 1 0 0 and semidefinite  • x 1 + x 1 subject to 0 1 0 = 1 . 0 , optimization  Better formulations 0 0 1 Data handling and   1 1 1 visualization  • x 1 + x 2 + x 3 1 1 1 = 0 . 5 , High performance  1 1 1 Summary � ( x 1 , x 2 , x 3 ) ∈ R 3 , x 2 2 + x 2 x 1 ≥ x 1 � 0 . 3 , sdo1$cones <- cbind( list("quad", c(1,2,3)) ) 17 / 48

  20. Second-order cone and semidefinite optimization   2 1 0 Introduction  • x 1 + x 1 1 2 1 minimize  Simple models 0 1 2 Advanced models   Second-order cone 1 0 0 and semidefinite  • x 1 + x 1 subject to 0 1 0 = 1 . 0 , optimization  Better formulations 0 0 1 Data handling and   1 1 1 visualization  • x 1 + x 2 + x 3 1 1 1 = 0 . 5 , High performance  1 1 1 Summary � ( x 1 , x 2 , x 3 ) ∈ R 3 , x 2 2 + x 2 x 1 ≥ x 1 � 0 . 3 , sdo1$bardim <- c(3) 18 / 48

  21. Second-order cone and semidefinite optimization   2 1 0 Introduction  • x 1 + x 1 1 2 1 minimize  Simple models 0 1 2 Advanced models   Second-order cone 1 0 0 and semidefinite  • x 1 + x 1 subject to 0 1 0 = 1 . 0 , optimization  Better formulations 0 0 1 Data handling and   1 1 1 visualization  • x 1 + x 2 + x 3 1 1 1 = 0 . 5 , High performance  1 1 1 Summary � ( x 1 , x 2 , x 3 ) ∈ R 3 , x 2 2 + x 2 x 1 ≥ x 1 � 0 . 3 , # Block triplet format (SDPA) sdo1$barc$j <- c(1,1,1,1,1) sdo1$barc$k <- c(1,2,2,3,3) sdo1$barc$l <- c(1,1,2,2,3) sdo1$barc$v <- c(2,1,2,1,2) 19 / 48

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend