browser icon
You are using an insecure version of your web browser. Please update your browser!
Using an outdated browser makes your computer unsafe. For a safer, faster, more enjoyable user experience, please update your browser today or try a newer browser.


Course Logistics

Formatting Mathematical Programs

This is a class in which clear and precise expression is essential. When formulating mathematical programs, you must say what you mean and make sure that others can understand what it is that you mean. You should follow the guidelines in the style guide, linked to below, when writing up your linear and integer programs. You are likely to lose points on assignments if you do not express and give brief explanations for the important elements of your mathematical programming formulations, as we demonstrate in this guide.

Matlab and Mathematica

These programs are available from Harvard to use on your personal computers (they are also installed on the computers in the labs. You can download them from here. The choice of which one to use (if any at all) is up to you… but you will probably want something to help you work with matrices and graph equations. Here are some useful guides written specifically for AM/ES 121 purposes.

AMPL Installation/Setup

AMPL (pronounced “ample”) allows you to interact more easily with commercial mathematical programming solvers such as CPLEX. Your code in the AMPL language must be submitted with particular assignments and with Extreme Optimizations. You must install the AMPL program, for which you need the temporary license we provide, to be able to run AMPL code in your Terminal (Mac) or Command Prompt (PC).

Here are some example AMPL models you will probably find useful to read through when first using AMPL: models

Visit Piazza for AMPL packages and installation instructions.


AMPL Usage

Below are links to guides that describe the AMPL language and code. We provide sample AMPL code along with some sections, lectures, and assignment packets.

Text Editors for AMPL

If you are working in a Mac environment, you may not be able to use the built in TextEdit for AMPL code.

  • Sublime Text: “Sublime Text is a sophisticated text editor for code, markup and prose.”
  • TextWrangler. “TextWrangler is a powerful and richly featured tool for composing, modifying, and transforming text stored in plain-text files.”

LaTeX for Homework write-ups

We strongly recommend that students use LaTeX for assignment write-ups, and it is required for Extreme Optimization write-ups. We provide several LaTeX resources to get you started, as many students coming into AM/ES 121 have not used LaTeX before.

We recommend editing TeX files a user-friendly LaTeX program such as “TexShop” (on Mac OSX) or “TexWorks” (on Windows). TexShop, TexWorks, and other LaTeX editors can be downloaded as part of a TeX distribution package online; make sure to download the full TeX distribution (not just the TeX editing program) in order to get your code to compile. For Mac OSX, download MacTeX distribution package (includes TexShop). For Windows, download TeX Live (includes TexWorks) or MiKTeX. Another great (cross-platform) LaTeX editor is Texmaker, with lots of additional features and macros to make life easier.

TexShop has useful snippets of code in its Macros list. In TexShop, select “LaTeX” from the drop-down box in the main toolbar, then click typeset to compile your code. In TexWorks, select “pdflatex” from the drop-down box on the left of the toolbar, then click the green play button to compile your code. In both cases, your code will need to be saved in a .tex file in a folder, and the compiling process will create a number of new LaTeX support files including an output pdf file. If your code does not compile, you will not get the pdf file you want; read the error message in the console, and fix your code at the line number the error specifies. Try Googling the error code or text if it is not clear to you what is wrong.

If you are having trouble downloading or coding in your LaTeX software, first check for answers to your question online, in the cheat sheets under Resources, or in this document. If you cannot find an answer, please do not hesitate to post on the message board or speak directly with your TF.

  • latex_assignments – Customized LaTeX template for AM/ES 121 assignment write-ups (txt file), the template that the TFs prefer you use, though you may make any modifications to the template for your own purposes
  • latex_snippets – Useful LaTeX code snippets for AM/ES 121 (pdf file), including a standard LP formulation and primal-dual template, and other helpful code for inequalities, graphics, matrices, and tableaux
  • [[ we’ll use Google sheets in 2016 for presentations ]] beamer_presentation – Beamer presentation template for Extreme Optimization presentations (txt file), allows you to very easily display math and text in a set of slides using the same code you use in your write-ups
  • latexsheetlatexsheet2 – Two short cheat sheets for LaTeX commands
  • The WikiBooks LaTeX Guide – A comprehensive but succinct online LaTeX commands reference
  • Links to further LaTeX documentation

Books on Reserve

  • Bradley, Stephen, Arnoldo C. Hax, & Thomas L. Magnanti – Applied mathematical programming
  • Fourer, Robert, David M. Gay & Brian Kernighan – AMPL: a modeling language for mathematical programming
  • Jensen, Paul A. & Jonathan F. Bard – Operations research: models &  methods
  • Wolsey, Laurence A. – Integer programming