{ "cells": [ { "cell_type": "markdown", "metadata": { "toc": "true" }, "source": [ "# Table of Contents\n", "
" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Optimization in Julia\n", "\n", "This lecture gives an overview of some optimization tools in Julia." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Julia Version 1.1.0\n", "Commit 80516ca202 (2019-01-21 21:24 UTC)\n", "Platform Info:\n", " OS: macOS (x86_64-apple-darwin14.5.0)\n", " CPU: Intel(R) Core(TM) i7-6920HQ CPU @ 2.90GHz\n", " WORD_SIZE: 64\n", " LIBM: libopenlibm\n", " LLVM: libLLVM-6.0.1 (ORCJIT, skylake)\n", "Environment:\n", " JULIA_EDITOR = code\n" ] } ], "source": [ "versioninfo()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Flowchart\n", "\n", "* Statisticians do optimizations in daily life: maximum likelihood estimation, machine learning, ...\n", "\n", "* Category of optimization problems:\n", "\n", " 1. Problems with analytical solutions: least squares, principle component analysis, canonical correlation analysis, ...\n", " \n", " 2. Problems subject to Disciplined Convex Programming (DCP): linear programming (LP), quadratic programming (QP), second-order cone programming (SOCP), semidefinite programming (SDP), and geometric programming (GP).\n", " \n", " 3. Nonlinear programming (NLP): Newton type algorithms, Fisher scoring algorithm, EM algorithm, MM algorithms. \n", " \n", " 4. Large scale optimization: ADMM, SGD, ...\n", " \n", "![Flowchart](./optimization_flowchart.png) " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Modeling tools and solvers\n", "\n", "Getting familiar with **good** optimization softwares broadens the scope and scale of problems we are able to solve in statistics. Following table lists some of the best optimization softwares. \n", "\n", "\n", "| | | LP | MILP | SOCP | MISOCP | SDP | GP | NLP | MINLP | | R | Matlab | Julia | Python | | Cost | \n", "|:---------:|:-:|:--:|:----:|:----:|:--------------:|:---:|:--:|:---:|:-----:|:-:|:-:|:------:|:-----:|:------:|:-:|:----:| \n", "| **modeling tools** | | | | | | | | | | | | | | | | | \n", "| cvx | | x | x | x | x | x | x | | | | | x | | x | | A | \n", "| Convex.jl | | x | x | x | x | x | | | | | | | x | | | O | \n", "| JuMP.jl | | x | x | x | x | | | x | x | | | | x | | | O | \n", "| MathProgBase.jl | | x | x | x | x | | | x | x | | | | x | | | O | \n", "| MathOptInterface.jl | | x | x | x | x | | | x | x | | | | x | | | O | \n", "| **convex solvers** | | | | | | | | | | | | | | | | | \n", "| Mosek | | x | x | x | x | x | x | x | | | x | x | x | x | | A | \n", "| Gurobi | | x | x | x | x | | | | | | x | x | x | x | | A | \n", "| CPLEX | | x | x | x | x | | | | | | x | x | x | x | | A | \n", "| SCS | | x | | x | | x | | | | | | x | x | x | | O | \n", "| **NLP solvers** | | | | | | | | | | | | | | | | | \n", "| NLopt | | x | | | | | | x | | | | x | x | x | | O | \n", "| Ipopt | | x | | | | | | x | | | | x | x | x | | O | \n", "| KNITRO | | x | x | | | | | x | x | | x | x | x | x | | $ | \n", "\n", "* O: open source \n", "* A: free academic license \n", "* $: commercial" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "* Difference between **modeling tool** and **solvers**\n", "\n", " - **Modeling tools** such as cvx (for Matlab) and Convex.jl (Julia analog of cvx) implement the disciplined convex programming (DCP) paradigm proposed by Grant and Boyd (2008)