Func Class Reference

The abstract base class for a function. More...

#include <func.h>

Inheritance diagram for Func:
Inheritance graph
[legend]
Collaboration diagram for Func:
Collaboration graph
[legend]

List of all members.

Public Types

enum  CurvatureType {
  CONVEX = 1, CONCAVE = 2, LINEAR = CONVEX | CONCAVE, UNKNOWN = 4,
  INDEFINITE = 12
}
 

Gets the convex shift parameter.

More...

Public Member Functions

 Func (int n=0, Pointer< ostream > out_func_p_=out_out_p, Pointer< ostream > out_func_log_p_=out_log_p)
 (Standard-)Constructor for optional dimension.
virtual ~Func ()
 Virtual Destructor.
int dim () const
 Gives the dimension.
virtual bool sparsity_available () const
 To check, whether the sparsity information is set.
virtual const SparsityInfoget_sparsity () const
 Gives the sparsity information with read-permissions.
virtual bool compute_sparsity_pattern (const vector< dvector > &sample_set)
virtual double eval (const UserVector< double > &x) const =0
 Computes the value of this function for a UserVector<double>.
virtual void grad (UserVector< double > &g, const UserVector< double > &x) const =0
 Computes the (sub)gradient for a UserVector<double>.
virtual dvector grad (const dvector &x) const
 Computes the (sub)gradient for a UserVector<double>.
virtual void HessMult (UserVector< double > &y, const UserVector< double > &x, const UserVector< double > &z) const =0
 Evaluates the product of the Hessian and a UserVector<double>.
virtual dvector HessMult (const dvector &x, const dvector &z) const
 Evaluates the product of the Hessian and a dvector.
virtual int valgrad (double &val, UserVector< double > &g, const UserVector< double > &x) const
 Computes the (sub)gradient and the value of this function for a UserVector<double>.
virtual void add_grad (UserVector< double > &g, const UserVector< double > &x) const
 Add's the (sub)gradient of this function to a UserVector<double>.
virtual void add_valgrad (double &val, UserVector< double > &g, const UserVector< double > &x) const
 Add's the (sub)gradient and the value of this function to a UserVector<double> and a double.
virtual double min_eig_hess (const UserVector< double > &x, Param *param=NULL) const
 Gives the minimum eigenvector of the Hessian in point x.
virtual void set_curvature (CurvatureType ct)=0
virtual CurvatureType get_curvature () const =0
virtual void print (ostream &out) const
 Print's out the dimension.

Static Public Member Functions

static CurvatureType add_curvatures (double a1, CurvatureType ct1, double a2, CurvatureType ct2)
static CurvatureType mult_curvature (double a, CurvatureType ct)

Public Attributes

Pointer< ostream > out_func_p
 A Pointer to an output-stream for function-relevant output.
Pointer< ostream > out_func_log_p
 A Pointer to an ostream to print function-relevant logging-information.

Protected Member Functions

virtual SparsityInfoget_sparsity ()

Protected Attributes

int dim_
 The dimension.
Pointer< SparsityInfosparsity

Friends

class VariableIterator
class MinusFunc
class SumFunc
ostream & operator<< (ostream &out, const Func &a)
 Prints some status information.
ostream & operator<< (ostream &out, const CurvatureType &ct)

Detailed Description

The abstract base class for a function.

You need to implement the following methods:

Definition at line 221 of file func.h.


Member Enumeration Documentation

Gets the convex shift parameter.

Parameters:
lower Lower bound of the box.
upper Upper bound of the box.
lev The level.
offset Will be added to the shift, if not convex.
Returns:
Convex shift parameters or 0, if function is convex.
Enumerator:
CONVEX 
CONCAVE 
LINEAR 
UNKNOWN 
INDEFINITE 

Definition at line 432 of file func.h.


Constructor & Destructor Documentation

Func::Func ( int  n = 0,
Pointer< ostream >  out_func_p_ = out_out_p,
Pointer< ostream >  out_func_log_p_ = out_log_p 
) [inline]

(Standard-)Constructor for optional dimension.

Parameters:
n The dimension, default is 0.
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 276 of file func.h.

virtual Func::~Func (  )  [inline, virtual]

Virtual Destructor.

Definition at line 282 of file func.h.


Member Function Documentation

virtual SparsityInfo& Func::get_sparsity (  )  [inline, protected, virtual]

Reimplemented in MinusFunc, SumFunc, and SepQcFunc.

Definition at line 243 of file func.h.

int Func::dim (  )  const [inline]

Gives the dimension.

Returns:
The dimension.
See also:
dim_

Definition at line 288 of file func.h.

virtual bool Func::sparsity_available (  )  const [inline, virtual]

To check, whether the sparsity information is set.

Returns:
True, if sparsity information is available. False, else.

Reimplemented in MinusFunc, SumFunc, and SepQcFunc.

Definition at line 293 of file func.h.

virtual const SparsityInfo& Func::get_sparsity (  )  const [inline, virtual]

Gives the sparsity information with read-permissions.

Reimplemented in MinusFunc, and SumFunc.

Definition at line 297 of file func.h.

virtual bool Func::compute_sparsity_pattern ( const vector< dvector > &  sample_set  )  [inline, virtual]

Reimplemented in MinusFunc, and SumFunc.

Definition at line 299 of file func.h.

virtual double Func::eval ( const UserVector< double > &  x  )  const [pure virtual]

Computes the value of this function for a UserVector<double>.

Abstract.

Parameters:
x The UserVector<double> to compute the value for.
Returns:
The value this(x) as double.

Implemented in amplObj, amplCon, SplitFunc, QqpDualFunc, MinusFunc, SumFunc, SepQcFunc, gamsFunc, Monom, and MinlpPenaltyFunc.

virtual void Func::grad ( UserVector< double > &  g,
const UserVector< double > &  x 
) const [pure 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>&)

Implemented in amplObj, amplCon, SplitFunc, QqpDualFunc, MinusFunc, SumFunc, SepQcFunc, gamsFunc, Monom, and MinlpPenaltyFunc.

virtual dvector Func::grad ( const dvector x  )  const [inline, virtual]

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

Parameters:
x The UserVector<double> to compute.
Returns:
The gradient as dvector.
See also:
grad(UserVector<double>&, UserVector<double>&)
add_grad(UserVector<double>&, const UserVector<double>&)
add_valgrad(UserVector<double>&, UserVector<double>&, const UserVector<double>&)

Reimplemented in MinusFunc.

Definition at line 326 of file func.h.

virtual void Func::HessMult ( UserVector< double > &  y,
const UserVector< double > &  x,
const UserVector< double > &  z 
) const [pure 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>&)

Implemented in amplObj, amplCon, SplitFunc, QqpDualFunc, MinusFunc, SumFunc, SepQcFunc, gamsFunc, Monom, and MinlpPenaltyFunc.

virtual dvector Func::HessMult ( const dvector x,
const dvector z 
) const [inline, virtual]

Evaluates the product of the Hessian and a dvector.

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

Reimplemented in MinusFunc.

Definition at line 347 of file func.h.

virtual int Func::valgrad ( double &  val,
UserVector< double > &  g,
const UserVector< double > &  x 
) const [inline, virtual]

Computes the (sub)gradient and the value of this function for a UserVector<double>.

Parameters:
val The double to store the value this(x).
g The UserVector<double> to store the gradient.
x The UserVector<double> to compute the gradient and value for.
Returns:
0, if all went right.
See also:
grad(UserVector<double>&, const UserVector<double>&)
add_grad(UserVector<double>&, const UserVector<double>&)
add_valgrad(UserVector<double>&, UserVector<double>&, const UserVector<double>&)

Reimplemented in QqpDualFunc, SumFunc, SepQcFunc, gamsFunc, and MinlpPenaltyFunc.

Definition at line 362 of file func.h.

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

Add's the (sub)gradient of this function to a UserVector<double>.

Parameters:
g The UserVector<double> to add the gradient to.
x The UserVector<double> to compute the gradient for.
See also:
grad(UserVector<double>&, const UserVector<double>&)
valgrad(double&, dvector&, const dvector&)
add_valgrad(double&, dvector&, const dvector&)

Definition at line 375 of file func.h.

virtual void Func::add_valgrad ( double &  val,
UserVector< double > &  g,
const UserVector< double > &  x 
) const [inline, virtual]

Add's the (sub)gradient and the value of this function to a UserVector<double> and a double.

Parameters:
val The double to add the value to.
g The UserVector<double> to add the gradient to.
x The UserVector<double> to compute the value and the gradient for.
See also:
eval(const UserVector<double>&)
add_grad(UserVector<double>&, const UserVector<double>&)

Definition at line 388 of file func.h.

virtual double Func::min_eig_hess ( const UserVector< double > &  x,
Param param = NULL 
) const [virtual]

Gives the minimum eigenvector of the Hessian in point x.

Parameters:
x The dvector to compute the Hessian for.
param Optional parameters for eigenvalue computation.
Returns:
The minimum eigenvector of the Hessian.
virtual void Func::set_curvature ( CurvatureType  ct  )  [pure virtual]
virtual CurvatureType Func::get_curvature (  )  const [pure virtual]
static CurvatureType Func::add_curvatures ( double  a1,
CurvatureType  ct1,
double  a2,
CurvatureType  ct2 
) [static]
static CurvatureType Func::mult_curvature ( double  a,
CurvatureType  ct 
) [static]
virtual void Func::print ( ostream &  out  )  const [inline, virtual]

Print's out the dimension.

Parameters:
out The ostream to print to.
See also:
dim()

Reimplemented in amplObj, amplCon, SplitFunc, QqpDualFunc, MinusFunc, SumFunc, SepFunc, SepQcFunc, gamsFunc, Monom, and MinlpPenaltyFunc.

Definition at line 446 of file func.h.


Friends And Related Function Documentation

friend class VariableIterator [friend]

Definition at line 230 of file func.h.

friend class MinusFunc [friend]

Definition at line 233 of file func.h.

friend class SumFunc [friend]

Definition at line 234 of file func.h.

ostream& operator<< ( ostream &  out,
const Func a 
) [friend]

Prints some status information.

Calls a.print(out).

Parameters:
out The ostream to print to.
a The Func to print.
Returns:
The ostream.
See also:
print(ostream &)

Definition at line 229 of file func.h.

ostream& operator<< ( ostream &  out,
const CurvatureType ct 
) [friend]

Member Data Documentation

int Func::dim_ [protected]

The dimension.

Definition at line 239 of file func.h.

Definition at line 241 of file func.h.

A Pointer to an output-stream for function-relevant output.

Set in the constructor, default is out_out_p.

See also:
out_func

Definition at line 250 of file func.h.

A Pointer to an ostream to print function-relevant logging-information.

Set in the constructor, default is out_log_p.

See also:
out_func_log

Definition at line 262 of file func.h.


The documentation for this class was generated from the following file:

Generated on 10 Mar 2013 for LaGO by  doxygen 1.6.1