From ME 575 - Optimization

Main: Optimization Course Software

There are many software tools available to solve optimization problems ranging from free and open-source to proprietary commercial packages. In general, students want to chose a software platform that will be both state-of-the-art and accessible long-term. Solving optimization problems requires some familiarity with a computer programming language. Some of the popular programming languages (see TIOBE index) also include capabilities for scientific computing.

Optimization Software

Information on APMonitor, MATLAB, OptdesX, and Python is listed below. Assignments and projects can be completed with any of these software platforms.


APMonitor

The APMonitor Modeling Language is optimization software for differential and algebraic equations. It is coupled with large-scale nonlinear programming solvers for data reconciliation, real-time optimization, dynamic simulation, and nonlinear predictive control. It is available as a web service through an internet browser or as an add-in package to MATLAB or Python programming languages.


MATLAB

MATLAB allows mathematical operations, plotting, creation of user interfaces, and interfacing with programs written in other languages, including C, C++, Fortran, and Java. A number of optimization tools are available in the Optimization Toolbox. An additional package, Simulink, adds graphical simulation and design for dynamic systems. MATLAB users come from engineering, science, and economics in both academic research and industrial applications. MATLAB is available through the following methods:

  1. Download MATLAB from software.byu.edu for installation on a personal computer
  2. BYU Citrix logon with a BYU CAEDM account
  3. BYU RGS servers with a BYU CAEDM account

Please note that Citrix and RGS perform computing on shared servers with performance that can be less desirable at times of high loading. The most reliable route is to download MATLAB on a personal computer.


OptdesX

The OptdesX software was developed at BYU. It contains some of the best algorithms still in use for constrained nonlinear optimization, including the algorithms in Excel and Matlab. We use OptdesX as a learning tool and we can get inside the code and see what the algorithms are doing, which we cannot do with other software. We can also look at gradients, which are very useful in understanding scaling and in developing robust designs. OptdesX is available through CAEDM Linux workstations or through remote logon to shared servers.


Python

Python is a high-level and general-purpose programming language and is a top choice for programmers (Google search). Part of the reason that it is a popular choice for scientists and engineers is the language versatility, online community of users, and powerful analysis packages such as Numpy and Scipy. This course uses Python 2.7 or Python 3.6+. Python is free and open-source and is easy to install with Anaconda (IPython, Jupyter, Spyder), PyCharm, or the Python.org distributions. Below is a tutorial on getting started with Python with a complete installation guide for Anaconda and Python.org.

Install Anaconda (recommended)

Install Python from Python.org

Install Packages with pip (Command Line)

Sometimes a script uses a package that is not yet installed. Once Python is installed, a package manager such as pip or conda can be used to install, remove, or update packages.

Below is an example on how to install APMonitor Optimization Suite from the command line (start cmd).

 pip install APMonitor

The APMonitor package name can be replaced with any available package name such as NumPy.

 pip install numpy

Install Packages with pip (Python Script)

Packages can also be managed from a Python script by attempting to load the package with try. If the import fails, the except section imports pip and installs the package.

Load and Optionally Install APMonitor Package

try:
   from APMonitor.apm import *
except:
   import pip
   pip.main(['install','APMonitor'])
   from APMonitor.apm import *

Load and Optionally Install NumPy Package

try:
   import numpy as np
except:
   import pip
   pip.main(['install','numpy'])
   import numpy as np

The APMonitor or NumPy package names can be replaced with any available package. The pip package manager connects to an online repository to retrieve the latest version of the package and install it. Sometimes a package is needed on a computer that isn't connected to the internet or the package isn't available through pip. Below is information on installing a package wheel (whl) file.

Install Package Wheels (whl) Offline

The pip package manager can also be used to install local (previously downloaded) wheel (.whl) files but dependencies may not be automatically installed if not connected to the internet. Below is an example wheel file installation for NumPy version 1.13.1 and SciPy version 0.19.1 for Python 3.6 with 64-bit Python.

 pip install numpy-1.13.1+mkl-cp36-cp36m-win_amd64.whl
 pip install scipy-0.19.1-cp36-cp36m-win_amd64.whl

Use Christoph Gohlke's whl files for Windows installations. Many of the packages depend on the Visual C++ 2015 Redistributable (x64 and x86 for CPython 3.5 and 3.6) that is available from Microsoft. After installing the Visual C++ redistributable, download and install NumPy and SciPy packages (in that order) for Python 3.6 on Windows. The downloaded wheel file names should not be changed because the wheel file name verifies compatibility with the current Python version.

There are many optimization packages that have been developed for Python with a few of them listed below:

This course uses the APM Python package for tutorials and class instruction. The APMonitor Modeling Language is integrated with Python through a set of functions that allow optimization problems to be solved as a web-service.

Additional links:


comments powered by Disqus
Retrieved from http://apmonitor.com/me575/index.php/Main/OptimizationTools
Page last modified on August 19, 2017, at 05:43 AM