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:
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.
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.
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