Mathematica Journal
Volume 10, Issue 1


In This Issue
Trott's Corner
New Products
New Publications
News Bulletins
New Resources

Download This Issue 

About the Journal
Editorial Policy
Staff and Contributors
Back Issues
Contact Information

Configuration Analysis and Design by Using Optimization Tools in Mathematica
Frank J. Kampas
János D. Pintér

Optimization in Mathematica

In this section, we briefly review NMinimize, a built-in general numerical optimization tool. This is followed by a somewhat more detailed summary of MathOptimizer, an application package.

Note that in addition to NMinimize, there are several other optimization-related functions in Mathematica, for example, ConstrainedMin and ConstrainedMax, which will also be discussed shortly. We entirely omit the discussion of the underlying theory and algorithms and refer the reader to The Mathematica Book [48], the current documentation [49, 50], and the optimization references listed earlier for details.

Built-in Optimization Tools

The following brief description of NMinimize is based on Mathematica's online help system.


NMinimize[{f, cons}, vars] numerically finds (approximates) the global minimum of an arbitrary linear or nonlinear function f subject to the arbitrary constraints cons. NMinimize implements several algorithms for finding global optima. According to the documentation for NMinimize, "The methods are flexible enough to cope with functions that are not differentiable or continuous, and are not easily trapped by local optima. Keep in mind, however, that finding a global optimum can be arbitrarily difficult, even without constraints, and so the methods used may fail. It may frequently be useful to optimize the function several times with different starting conditions and take the best of the results." This caveat is of obvious relevance with respect to all general numerical (global) optimization approaches.

The following simple example illustrates the usage of this function. First, load the package if necessary (in Mathematica 5, NMinimize is autoloaded).

Figure 2 shows the objective function over the interval defined by the explicit bounds. Note that the added constraint cuts off a part of this box region.

Figure 2. The function in the two-dimensional "box" region .


MathOptimizer [38] is a third-party native Mathematica product that enables the global and local solution of the general class of optimization problems encompassed by the CGO model form. The key features of this package are summarized next. For theoretical background, refer to [35] and the other GO textbooks listed earlier.

MathOptimizer currently consists of two core solver packages and a solver integrator package. One of these solvers is used for the typically approximate global optimization of an aggregated "merit" (exact penalty) function on the given interval range , in the possible presence of added constraints g and h. This package is based on an efficient adaptive stochastic search method, combined with a statistical bounding procedure. The latter provides an estimate of the global optimum value, based on the global sampling results.

The second solver package implements a convex optimization approach aimed at finding a solution vector that satisfies the Karush-Kuhn-Tucker local optimality conditions. This solver option can be used for "precise" local optimization, based on the initial solution produced by the global search phase or provided by the user. (Note that, at least theoretically, all CGO model functions should be smooth, in order to support the application of this solver component.)

The solver integrator package enables the individual or combined use of these two solver packages; the solvers can also be used separately. (Further solver modules are under development and will be made available.)

The MathOptimizer User Guide [38] is a Mathematica notebook that can be directly invoked through the online Help Browser. The user guide includes installation and technical notes and provides concise mathematical background information and modeling tips. In addition to a basic usage description, it also discusses a number of simple and more challenging test problems and a few detailed application examples.

MathOptimizer can be installed and used on all hardware platforms that are suitable to run Mathematica 3.0 or later. It is available for all Microsoft Windows (95 and later) operating systems, as well as all other platforms that have corresponding current Mathematica implementations. Several prominent OS examples are Linux, Macintosh (including Mac OS X), HP-UX, SGI, Solaris, and Sun (Unix flavor) platforms. MathOptimizer software installation and tests with identical file systems were successfully completed using over half a dozen different hardware platforms and operating systems (at the time of this writing, including all the aforementioned platforms).

MathOptimizer Usage Definitions and Options

Assuming that MathOptimizer is set up using the Mathematica standard directory structure, it can be invoked by the following statement.

Here is the concise information regarding how to use Optimize.

We will not go into further, quite extensive, details of the package options and refer the reader to the MathOptimizer User Guide [38] for more information. Instead, we shall illustrate the usage of the function Optimize on the last problem discussed in the preceding section.

Here are the main steps of the modeling and solution procedure. Comments set in blue serve only for explanation.

The output of MathOptimizer consists of the numerically estimated list of optimal solution components, the corresponding objective function value, the lists of the equality and inequality model function values at the solution (including an empty list of equality constraints in this example), the list of the maximal feasibility violation level at the solution, the violation level of the Karush-Kuhn-Tucker equation at the solution, and the violation level of the complementary slackness condition at the solution.

Without going into further details, let us note that the output indicates that the local optimality conditions are satisfied to a fairly high precision and that the solution agrees with the one found by NMinimize to at least precision, in terms of both the optimized arguments and the optimum value.

In the next (Contact and Collision Problems) section, we shall illustrate the usage of MathOptimizer and NMinimize in the context of several nontrivial tests that point towards interesting application areas. An extensive collection of further numerical examples and illustrative applications formulated in Mathematica is discussed in [29, 39].

About Mathematica | Download Mathematica Player
© Wolfram Media, Inc. All rights reserved.