FMINCON_PARALLEL
Minimization via FMINCON and the Parallel Computing Toolbox


FMINCON_PARALLEL is a MATLAB program which demonstrates how the FMINCON function, which is used to find the constrained minimizer of a function, can use MATLAB's Parallel Computing Toolbox to perform some calculations in parallel.

The program transcribes a (class of) optimal control problem(s) to finite-dimensional nonlinear programming problems and then invokes the Matlab solver fmincon. The problem has a fixed initial state, a fixed terminal time, a Mayer cost functional and a scalar-valued control function. Data for a specific problem are supplied by the user; zermelo.m is an example based on efficient navigation of a boat in a spatially varying current.

Usage:

run_opt ( 'function_file', intervals )
where

The user must supply certain routines:

as well as PAR.x0, the initial condition for the state.

The user may also supply optional routines:

No error checking is done to ensure that the specified problem data are consistent. Strange error messages may result from such inconsistency (e.g. the dimension of the state - the 'size' of the returned output from PAR.rhs - must be same as the 'size' of PAR.x0, and the same as the 'size' of the input arguments to PAR.cost, PAR.eq, and PAR.ineq).

To run the code with the sample problem, the command might be

run_opt ( 'zermelo.m', 16 )

To run the code with the sample problem and the Parallel Computing Toolbox, the command might be

matlabpool open local 4
run_opt ( 'zermelo.m', 16 )
matlabpool close
where, in this case, we have only asked for 4 MATLAB workers. Assuming successful convergence, plots showing the path of the boat in the plane and a time history of the piecewise constant controlm will be displayed.

Licensing:

The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.

Related Data and Programs:

CELL_DETECTION_TASKS, a MATLAB program which creates modified versions of a sequence of gray-scale TIF files containing images of cells; the process of each file is carried out independently, using the "task" feature of MATLAB's parallel computing toolbox.

CG_DISTRIBUTED, a MATLAB program which implements a version of the NAS CG conjugate gradient benchmark, using distributed memory.

COLLATZ_PARFOR, a MATLAB program which seeks the maximum Collatz sequence between 1 and N, running in parallel using MATLAB's "PARFOR" feature.

CONTRAST_SPMD, a MATLAB program which demonstrates the SPMD parallel programming feature for image operations; the client reads an image, the workers increase contrast over separate portions, and the client assembles and displays the results.

CONTRAST2_SPMD, a MATLAB program which demonstrates the SPMD parallel programming feature for image operations; this improves the contrast_spmd program by allowing the workers to share some data; this makes it possible to eliminate artificial "seams" in the processed image.

FD2D_HEAT_EXPLICIT_SPMD, a MATLAB program which uses the finite difference method and explicit time stepping to solve the time dependent heat equation in 2D. A black and white image is used as the "initial condition". MATLAB's SPMD facility is used to carry out the computation in parallel.

IMAGE_DENOISE_SPMD, a MATLAB program which demonstrates the SPMD parallel programming feature for image operations; the client reads an image, the workers process portions of it, and the client assembles and displays the results.

LINEAR_SOLVE_DISTRIBUTED, a MATLAB program which solves a linear system A*x=b using MATLAB's spmd facility, so that the matrix A is "distributed" across multiple MATLAB workers.

MATLAB_PARALLEL, MATLAB programs which illustrate "local" parallel programming on a single computer with MATLAB's Parallel Computing Toolbox.

MD_PARFOR, a MATLAB program which carries out a molecular dynamics simulation, running in parallel using MATLAB's "PARFOR" feature.

ODE_SWEEP_PARFOR, a MATLAB program which demonstrates how the PARFOR command can be used to parallelize the computation of a grid of solutions to a parameterized system of ODE's.

PLOT_SPMD, a MATLAB library which demonstrates the SPMD parallel programming feature, by having a number of labs compute parts of a sine plot, which is then displayed by the client process.

PRIME_PARFOR, a MATLAB program which counts the number of primes between 1 and N; running in parallel using MATLAB's "PARFOR" feature.

PRIME_SPMD, a MATLAB program which counts the number of primes between 1 and N; running in parallel using MATLAB's "SPMD" feature.

QUAD_PARFOR, a MATLAB program which estimates an integral using quadrature; running in parallel using MATLAB's "PARFOR" feature.

QUAD_SPMD, a MATLAB program which estimates an integral using quadrature; running in parallel using MATLAB's "SPMD" feature.

QUAD_TASKS, a MATLAB program which estimates an integral using quadrature; running in parallel using MATLAB's "TASK" feature.

RANDOM_WALK_2D_AVOID_TASKS, a MATLAB program which computes many self avoiding random walks in 2D by creating a job which defines each walk as a task, and then computes these independently using MATLAB's Parallel Computing Toolbox task computing capability.

SATISFY_PARFOR, a MATLAB program which demonstrates, for a particular circuit, an exhaustive search for solutions of the circuit satisfiability problem, running in parallel using MATLAB's "PARFOR" feature.

SUBSET_SUM_TASKS, a MATLAB program which solves a subset sum problem by exhaustive search, subdividing the search range among separate tasks.

Author:

Gene Cliff,
Aerospace and Ocean Engineering / Interdisciplinary Center for Applied Mathematics,
Virginia Tech.

Reference:

The User's Guide for the Parallel Computing Toolbox is available at http://www.mathworks.com/access/helpdesk/help/pdf_doc/distcomp/distcomp.pdf

Source Code:

Examples and Tests:

ZERMELO is an example problem describing the efficient navigation of a boat in a spatially varying current. The name "zermelo" is to be used for the F_NAME parameter of RUN_OPT.

You can go up one level to the MATLAB source codes.


Last revised on 31 March 2010.