Sandia Home Sandia Home
Main Page | Publications | Downloads | Configuration | Running the Code | Solver Parameters | FAQ | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

example3.cpp File Reference


Detailed Description

Example with bound constraints and nonlinear constraints (handled using a simple penalty).

Example 3 function evaluation progam. This function evaluation expects its input to come from a text file, and it writes its output to to a text file.

The test problem is:

\[ \begin{array}{ll} \min & x^2 + y^2 + z^2 \\ \mbox{s.t.} & x^2 + (y-2)^2 + z^2 \le 3 \\ & (x-2)^2 + y^2 + z^2 \le 3 \\ & x \le 30 \\ & 1 \le y \le 30 \\ & z \le 30 \end{array} \]

The nonlinear constraints are handled using a penalty approach. Define

\[ \begin{array}{rcl} c_1(x) & \equiv & \min\{0,3 - [x^2 + (y-2)^2 + z^2]\} \\ c_2(x) & \equiv & \min\{0,3 - [(x-2)^2 + y^2 + z^2]\} \end{array} \]

The objective value that is return in the output file is:

\[ \hat f(x) \equiv f(x) + [c_1(x)]^2 + [c_2(x)]^2 \]

The bounds are handled in the example3.apps input file, where we also define the scaling and intial guessis defined as:

\[ s = \begin{bmatrix}1\\1\\1\end{bmatrix} \]

This example courtesy of William Hart, Sandia National Labs.

Definition in file example3.cpp.

#include <iostream>
#include <fstream>
#include <vector>

Include dependency graph for example3.cpp:

Include dependency graph

Go to the source code of this file.

Functions

double feval (const vector< double > &x)
 Function Evaluation.
int main (int argc, char *argv[])
 Main.


Function Documentation

double feval const vector< double > &  x  ) 
 

Function Evaluation.

Definition at line 92 of file example3.cpp.

int main int  argc,
char *  argv[]
 

Main.

Definition at line 116 of file example3.cpp.

References feval().

 

© Sandia Corporation | Site Contact | Privacy and Security

Generated on Fri Feb 16 10:33:35 2007 for APPSPACK 5.0.1 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2002