Parallel Computing in Optimization Toolbox™ Functions

Parallel Optimization Functionality

Parallel computing is the technique of using multiple processors on a single problem. The reason to use parallel computing is to speed computations.

The Optimization Toolbox™ solvers fmincon, fgoalattain, and fminimax can automatically distribute the numerical estimation of gradients of objective functions and nonlinear constraint functions to multiple processors. These solvers use parallel gradient estimation under the following conditions:

When these conditions hold, the solvers compute estimated gradients in parallel.

Currently, UseParallel cannot be accessed using the Optimization Tool GUI.

Parallel Estimation of Gradients

One subroutine was made parallel in the functions fmincon, fgoalattain, and fminimax: the subroutine that estimates the gradient of the objective function and constraint functions. This calculation involves computing function values at points near the current location x. Essentially, the calculation is

f(x) ≈ [(f(x + Δ1e1) – f(x))/Δ1, (f(x + Δ2e2) – f(x))/Δ2,...,(f(x + Δnen) – f(x))/Δn],

where

To estimate ∇f(x) in parallel, Optimization Toolbox solvers distribute the evaluation of (f(x + Δiei) – f(x))/Δi to extra processors.

fmincon uses the parallel subroutine only with the active-set algorithm. fgoalattain and fminimax always use the parallel subroutine.

Nested Parallel Functions

Solvers employ the Parallel Computing Toolbox function parfor to perform parallel estimation of gradients. parfor does not work in parallel when called from within another parfor loop. Therefore, you cannot simultaneously use parallel gradient estimation and parallel functionality within your objective or constraint functions.

Suppose, for example, your objective function userfcn calls parfor, and you wish to call fmincon in a loop. Suppose also that the conditions for parallel gradient evaluation of fmincon, as given in Parallel Optimization Functionality, are satisfied. Figure When parfor Runs In Parallel shows three cases:

  1. The outermost loop is parfor. Only that loop runs in parallel.

  2. The outermost parfor loop is in fmincon. Only fmincon runs in parallel.

  3. The outermost parfor loop is in userfcn. userfcn can use parfor in parallel.

When parfor Runs In Parallel

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS