- Path Planner using Mixed-Integer Linear Programming
- Model Predictive Control of UAV with Obstacle Avoidance
- AMPL Interface for Matlab
- GLPSOL Interface for Matlab

**All software on this page is provided purely for demonstration to researchers.**

This free Matlab utility and (optional) graphical front end allow you to solve 2-D path-planning problems with obstacle avoidance. You will need:

- The path-planner files milp_path.m (the core Matlab function) and milp_path.mod (the AMPL model file). Type "help milp_path" at the Matlab prompt for usage, or use the GUI.
- The AMPL interface for Matlab and the GLPSOL interface for Matlab.
- The Gnu Linear Programming Kit, including GLPSOL, the stand-alone solver - see http://www.gnu.org/software/glpk/.
- The optional GUI files milp_path_gui.m (the Matlab GUI function); milp_path_gui.fig (the Matlab GUI figure file); milp_help.html (the GUI help file); and milp_example.mat (an example data file). Type "milp_path_gui" at the Matlab prompt to run. Use the "Help" menu to learn more or use "File>Load" to open the example problem.

From this page you can download MATLAB and AMPL code to simulate robust Model Predictive Control (MPC) of a UAV with obstacle avoidance constraints using Mixed-Integer Linear Programming (MILP) (see figure at right: click to enlarge). The example runs within Matlab under Windows using the free trial edition of AMPL/CPLEX.

- Download the (free) student edition of AMLP from http://www.ampl.com
- Unpack the AMPL package to a directory of your choice (this is a simple unzipping operation - you do not need administrator rights to install AMPL)
- Click here to download the zip file of the example code.
- Unpack the example zip file to a directory.
- Edit the file 'myampl.bat' so that the AMPL directory from Step 2 is added to your 'path' variable.
- In Matlab, go the example directory from Step 4, and run the
script 'uavsmall.m'.
*You should see some optimization messages and then the figure shown above.*

- You can change the parameters of the problem in the file 'uavsmall.m' to investigate different scenarios. However, the parameters provided in the example have been chosen to suit the limits of the student edition of AMPL. More complicated problems will most likely require the full version of AMPL/CPLEX. You will get an AMPL error message if the problem is too big for the student version.
- Researchers using this software (or software derived from it) in their own work should cite this paper: Arthur Richards and Jonathan How, "Model Predictive Control of Vehicle Maneuvers with Guaranteed Completion Time and Robust Feasibility" American Control Conference, Denver, Colorado, June 2003.
- This software was originally developed at the Aerospace Controls Laboratory, Department of Aeronautics and Astronautics, MIT

These Matlab utilities generate parameter entries in AMPL data files to represent data values generated in Matlab. For example, the following Matlab code

rts = [3 -1; 7 1.5]'; fid=fopen('milppath.dat','w'); AMPLmatrix(fid,'ro',rts); fclose(fid);produces a file named "milppath.dat" containing the following AMPL code

param ro : 1 2 := 1 3.00000000000000 7.00000000000000 2 -1.00000000000000 1.50000000000000 ;As well as the matrix utility shown in this example, other functions are provided to generate scalars, vectors, 3-D matrices, and integer forms of all of these elements. See http://www.ampl.com for details about AMPL.

The author uses the interface to embed AMPL-based optimisation within Matlab programs. The AMPL model and script files are written by hand. A Matlab script is used to process and generate the data values, write the AMPL parameter file, invoke AMPL using a system call, read the AMPL output file and post-process the results. The UAV demonstration below employs these utilities.

The same utilities can be used with GLPK (GNU Linear Programming Kit). The GLPK MathProg language is a subset of AMPL. See http://www.gnu.org/software/glpk for details. The GLPSOL Interface for Matlab below provides a utility for reading in the results from GLPSOL.

- AMPLcomment.m
- AMPLmatrix.m
- AMPLmatrixint.m
- AMPLmtrx3d.m
- AMPLscalar.m
- AMPLscalarint.m
- AMPLvector.m
- AMPLvectorint.m

GLPSOL is the stand-alone MILP solver that comes with GLPK, the GNU Linear Programming Kit. See http://www.gnu.org/software/glpk for more information and access to GLPK download sites. GLPSOL can read most AMPL models and data using the "-m" and "-d" options (see GLPK documentation or use "glpsol -h" for details.) However, the detailed output format provided by the "-o" option is, to my knowledge, unique. The "glpkread.m" Matlab utility provided here reads the GLPSOL output file and returns solution values in Matlab variables. For example, the following Matlab command

>> [flag,xm,ym] = glpkread('data.txt','x','y')will open the file "data.txt" and, if it can understand it as a GLPSOL output file and find the decision variables "x" and "y", it will read the value of GLPK variable "x" into Matlab variable "xm" and GLPK variable "y" into Matlab variable "ym". The Matlab variable "flag" will be set to 1 if a status line indicating successful solution was found, or will be 0 otherwise. Use

>>help glpkreadfor details.

File has been renamed from ".m" extension to ".m.txt" to prevent confusion by browsers