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

example2a.cpp File Reference

Detailed Description

Example with bound constraints and a nonlinear constraint, now handled using APPSPACK's built-in extreme barrier approach.

A simple example of a function evaluation that takes its input from a text file, and it writes a single objective value and its constraint value to an output file, one entry per line.

In this case, the two-dimensional example function is:

\[ f(x) = x_1^2 + 2 x_2^2 \]

And there is also a constraint:

\[ c(x) \equiv x_1^2 + x_2^2 - 1 \geq 0 \]

The input file example2a.apps, to be used with example2a.cpp, includes the following lower and upper bounds and initial point:

\[ \ell = \begin{bmatrix}-1\\-1\end{bmatrix}, \quad u = \begin{bmatrix}3\\3\end{bmatrix}, \quad x^{(0)} = \begin{bmatrix}0.2\\0.3\end{bmatrix} \]

See also:
example2a.cpp is a variation on this example that writes both its function value and its constraint value to the output file. This special case can be easily handled via the APPSPACK::Combiner::Generic function that combines multiple function values into a single value.

Definition in file example2a.cpp.

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

Include dependency graph for example2a.cpp:

Include dependency graph

Go to the source code of this file.


double feval (const vector< double > &x)
 Function Evaluation.
double constraint (vector< double > &x)
 Nonlinear Constraint c(x) >= 0.
int main (int argc, char *argv[])

Function Documentation

double feval const vector< double > &  x  ) 

Function Evaluation.

Definition at line 80 of file example2a.cpp.

double constraint vector< double > &  x  ) 

Nonlinear Constraint c(x) >= 0.

Definition at line 92 of file example2a.cpp.

int main int  argc,
char *  argv[]


Definition at line 104 of file example2a.cpp.

References constraint(), and feval().


© Sandia Corporation | Site Contact | Privacy and Security

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