amplObj Class Reference

Class for an AMPL-objective-function. More...

#include <ampl.h>

Inheritance diagram for amplObj:

Inheritance graph
[legend]
Collaboration diagram for amplObj:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 amplObj (int dim_=0, Pointer< SparsityInfo > sparsity_=NULL, Pointer< ostream > out_func_p_=out_out_p, Pointer< ostream > out_func_log_p_=out_log_p)
 (Standard-)Constructor with optional the dimension.
double eval (const UserVector< double > &x) const
 Evaluates the objective for a UserVector<double>.
void grad (dvector &g, const dvector &x) const
 Computes the gradient of the objective for a dvector.
void grad (UserVector< double > &g, const UserVector< double > &x) const
 Computes the (sub)gradient for a UserVector<double>.
void HessMult (dvector &y, const dvector &x, const dvector &z) const
 Computes the product of a Hessian and a dvector.
void HessMult (UserVector< double > &y, const UserVector< double > &x, const UserVector< double > &z) const
 Evaluates the product of the Hessian and a UserVector<double>.
void set_curvature (CurvatureType ct)
CurvatureType get_curvature () const
void print (ostream &out) const
 Prints some information about this function.

Private Attributes

Func::CurvatureType curv_type

Detailed Description

Class for an AMPL-objective-function.

This class is used to compute a nonlinear objective of a problem, which was described by an ampl-file.

Definition at line 66 of file ampl.h.


Constructor & Destructor Documentation

amplObj::amplObj ( int  dim_ = 0,
Pointer< SparsityInfo sparsity_ = NULL,
Pointer< ostream >  out_func_p_ = out_out_p,
Pointer< ostream >  out_func_log_p_ = out_log_p 
) [inline]

(Standard-)Constructor with optional the dimension.

Parameters:
dim_ The dimension of the function.
out_func_p_ An ostream to print function-related output to, default is out_out_p.
out_func_log_p_ An ostream to print function-related logging-output to, default is out_func_p.

Definition at line 75 of file ampl.h.

References Func::sparsity.


Member Function Documentation

double amplObj::eval ( const UserVector< double > &  x  )  const [inline, virtual]

Evaluates the objective for a UserVector<double>.

Calls objval(...) from the AMPL/Solver Interface Library (ASL).

Parameters:
x The UserVector<double> to evaluate.
Returns:
The value of the objective.

Implements Func.

Definition at line 85 of file ampl.h.

References asl, UserVector< Type >::dim(), and out_log.

Referenced by HessMult().

void amplObj::grad ( dvector g,
const dvector x 
) const [inline]

Computes the gradient of the objective for a dvector.

Calls objgrd(...) from the AMPL/Solver Interface Library (ASL).

Parameters:
g The dvector to store the result in.
x The dvector to compute the gradient for.

Definition at line 103 of file ampl.h.

References asl, DenseVector< Type >::dim(), and out_log.

void amplObj::grad ( UserVector< double > &  g,
const UserVector< double > &  x 
) const [inline, virtual]

Computes the (sub)gradient for a UserVector<double>.

Abstract.

Parameters:
g The UserVector<double> to store the result in.
x The UserVector<double> to compute the gradient for.
See also:
grad(const dvector&)

valgrad(double&, UserVector<double>&, const UserVector<double>&)

add_grad(UserVector<double>&, UserVector<double>&)

add_valgrad(double&, UserVector<double>&, UserVector<double>&)

Implements Func.

Definition at line 116 of file ampl.h.

References asl, UserVector< Type >::dim(), out_log, UserVector< Type >::set(), and UserVector< Type >::size().

void amplObj::HessMult ( dvector y,
const dvector x,
const dvector z 
) const [inline]

Computes the product of a Hessian and a dvector.

Parameters:
y The dvector to store the result in.
x The dvector to compute the Hessian for.
z The dvector to multiply with the Hessian.

Definition at line 139 of file ampl.h.

References eval().

void amplObj::HessMult ( UserVector< double > &  y,
const UserVector< double > &  x,
const UserVector< double > &  z 
) const [inline, virtual]

Evaluates the product of the Hessian and a UserVector<double>.

Abstract.

Parameters:
y The UserVector<double> to store the result in: $ y = \nabla^2 f(x) \cdot z $.
x The UserVector<double> to evaluate the Hessian for.
z The UserVector<double> to multiply with the Hessian.
See also:
HessMult(const UserVector<double>&, const UserVector<double>&)

Implements Func.

Definition at line 144 of file ampl.h.

References UserVector< Type >::dim(), eval(), UserVector< Type >::set(), and UserVector< Type >::size().

void amplObj::set_curvature ( CurvatureType  ct  )  [inline]

Definition at line 154 of file ampl.h.

References curv_type.

CurvatureType amplObj::get_curvature (  )  const [inline, virtual]

Implements Func.

Definition at line 155 of file ampl.h.

References curv_type.

void amplObj::print ( ostream &  out  )  const [inline, virtual]

Prints some information about this function.

Prints the dimension.

Parameters:
out The ostream to print to.

Reimplemented from Func.

Definition at line 161 of file ampl.h.

References Func::dim().


Member Data Documentation

Func::CurvatureType amplObj::curv_type [private]

Definition at line 68 of file ampl.h.

Referenced by get_curvature(), and set_curvature().


The documentation for this class was generated from the following file:
Generated on Tue Oct 21 03:12:21 2008 for LaGO by  doxygen 1.4.7