QqpDualFunc Class Reference

A base class for evaluating the dual function. More...

#include <dualqqp.h>

Inheritance diagram for QqpDualFunc:

Inheritance graph
[legend]
Collaboration diagram for QqpDualFunc:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 QqpDualFunc (MinlpProblem &qqp_, Param &param_, Pointer< ostream > out_func_p_=out_out_p, Pointer< ostream > out_func_log_p_=out_log_p)
 Constructor for a MinlpReform and a shift.
virtual int valgrad (double &val, UserVector< double > &g, const UserVector< double > &z) const
 Evaluates the function value and computes the subgradient of the dual function.
double eval (const UserVector< double > &z) const
 Evaluates this function for a dvector.
void grad (UserVector< double > &g, const UserVector< double > &x) const
 Computes the gradient of this function.
virtual void HessMult (UserVector< double > &y, const UserVector< double > &x, const UserVector< double > &z) const
 Does nothing.
dvector get_dual_point () const
 The last dual point of the original qqp.
dvector get_dual_point (dvector &ext_dual_point) const
 The dual point of the original qqp for an extended dual point.
double get_dual_val () const
 The last dual value.
double get_dual_val (dvector &ext_dual_point) const
 The dual value for an extended dual point.
dvector get_orig_point (int use_eig_vec=0) const
 Gives the solution point of the Lagrangian function.
dvector get_orig_point (dvector &ext_dual_point, int use_eig_vec=0) const
 The dual value for an extended dual point.
int nr_of_orig_points () const
 The number of eigenvectors, which are computed in each evaluation.
void print (ostream &out) const
 Print's a lot of information about this function.

Public Attributes

int num_matmult
 number of matrix vector multiplications
double eig_time
 time spent by the eigenvalue calculation
dvector dual_point
 The dual variables of the extended (!) dual function.

Protected Types

 LIN
 QUAD
 EXTQUAD
enum  b_type { LIN, QUAD, EXTQUAD }
 The different block-types. More...

Protected Member Functions

int num_qbox () const
 The number of quadratic-box-constraints.
int num_blocks () const
 The number of blocks.
void init_ext ()
 Check's, if partial Lagrange problem is extended Set ext[k] to true, if the bounds are not symmetric or no linear part exists.
void init ()
 Initialization of the dual function.
void set_ball_con ()
 Initialize the ball constraints.
void get_bc (double &c_, dvector &b_, SepQcFunc &q)
 Compute's modified b,c values for a SepQcFunc.
void set_bc ()
 Initialize the modified b,c-values.
int set_dual_val () const
 Compute the value of the dual function.
double eval_mod_con (int con_nr) const
 Evaluates a modified constraint.
double eval_mod_obj () const
 Evaluates the modified objective.
void set_subgrad () const
 Compute a subgradient of the dual function.

Protected Attributes

vector< b_typeblock_type
 Indicates for each block, which type the block of the lagrange problem has.
ivector i_ext
 The indices of the new quadratic box constraints.
int num_ext
 The number of extended blocks.
ivector i_q
 The index of the start of the quadratric box constraints for the k-th block.
int n_q
 The number of quadratic variables.
dvector mid_point
 The mid point of the box = 0.5*(lower+upper).
BlockMatrix W
 The half-length of the edges of the box.
dvector radius
 The radius of the ball-constraints.
vector< bool > ball_con
 The type of the ball-constraints.
vector< dvectorb_con
 The modified b-values for the constraints.
dvector b_obj
 The modified b-value for the objective-function.
dvector c_con
 The modified c-values for the constraints.
double c_obj
 The modified c-value for the objective-function.
vector< Pointer< UserMatrix > > A_lag
 The block matrices of the modified Lagrangian Set in init.
vector< dvectorb_lag
 The linear part of the modified Lagrangian Set in init.
double c_lag
 The constant part of the modified Lagrangian Set in init.
dvector x_lag
 The Lagrange solution.
double dual_val
 current value of the dual function.
dvector subgrad
 The subgradient.
vector< vector< double > > eig_val
 minimal eigenvalues of A_lag[k], k=0,.
vector< vector< dvector > > eig_vec
 eigenvectors of A_lag[k], k=0,.

Friends

class QqpMatrix
class QqpExtMatrix

Detailed Description

A base class for evaluating the dual function.

$ D(\lambda )= \sum_{k=1}^{l-1}(\rho_k^2\cdot \min\{eig_{min}(\tilde A_k(\lambda)),0\} +\sum_{j=r_l}^{r_{l+1}}\min\{\underline x_{j}b_{j}(\lambda ), \bar x_{j}b_{j}(\lambda )\})+\tilde c(\lambda ) $

assignment of the dual variables:

0:n-1 quadratic box-constraints of original variables

n:n+block_size-1 quadratic box-constraints of the new variables

block_size+n:block_size+n+con_size-1 remaining constraints

Definition at line 100 of file dualqqp.h.


Member Enumeration Documentation

enum QqpDualFunc::b_type [protected]

The different block-types.

QUAD: the hessian of this block is non-zero and the linear part is zero.

EXTQUAD: the hessian of this block and the linear part is non-zero.

LIN: the hessian is zero.

Enumerator:
LIN 
QUAD 
EXTQUAD 

Definition at line 112 of file dualqqp.h.


Constructor & Destructor Documentation

QqpDualFunc::QqpDualFunc ( MinlpProblem qqp_,
Param param_,
Pointer< ostream >  out_func_p_ = out_out_p,
Pointer< ostream >  out_func_log_p_ = out_log_p 
) [inline]

Constructor for a MinlpReform and a shift.

Parameters:
qqp_ The MinlpReform, the DualFunc consists of.
param_ Parameters.
out_func_p_ A pointer to an output stream for function output.
out_func_log_p_ A pointer to an output stream for function logging output.

Definition at line 334 of file dualqqp.h.

References init().


Member Function Documentation

int QqpDualFunc::num_qbox (  )  const [inline, protected]

The number of quadratic-box-constraints.

Returns:
The number of quadratic-box-constraints.

Definition at line 237 of file dualqqp.h.

References n_q, and num_ext.

int QqpDualFunc::num_blocks (  )  const [inline, protected]

The number of blocks.

Returns:
The number of blocks.

Definition at line 242 of file dualqqp.h.

References MinlpProblem::block, and DualFunc::qqp.

void QqpDualFunc::init_ext (  )  [protected]

Check's, if partial Lagrange problem is extended Set ext[k] to true, if the bounds are not symmetric or no linear part exists.

Or you say: Check, if modified b_k's are zero.

See also:
ext

void QqpDualFunc::init (  )  [protected]

Initialization of the dual function.

Allocating memory, setting counters to zero, computing u,W...

Check's, whether the Lagrange problem is extended by calling init_ext().

Set's the modified c,b-values by calling set_bc(). Set's the ball-constraint type by calling set_ball_con(lower, upper).

See also:
init_ext()

set_bc()

set_ball_con()

Referenced by QqpDualFunc().

void QqpDualFunc::set_ball_con (  )  [protected]

Initialize the ball constraints.

Initialize the ball constraints for each block with the corresponding part of lower and upper. Set's the type of each ball-constraint to true, if it contains one not-discrete variable.

See also:
ball_con

void QqpDualFunc::get_bc ( double &  c_,
dvector b_,
SepQcFunc q 
) [protected]

Compute's modified b,c values for a SepQcFunc.

Sums mid_point[k]*q.A[k]*mid_point[k] + q.b[k]*mid_point[k] over all blocks. Adds the constant part of q: q.c

Parameters:
c_ The modified c-value.
b_ The modified b-value.
q The SepQcfunc to compute.

void QqpDualFunc::set_bc (  )  [protected]

Initialize the modified b,c-values.

Computes for each constraint and the objective the modified b,c-values by calling get_bc.

See also:
get_bc(double&, dvector&, SepQcFunc&)

b_con

b_obj

c_con

c_obj

int QqpDualFunc::set_dual_val (  )  const [protected]

Compute the value of the dual function.

The function value is stored in dual_val.

See also:
dual_val
Returns:
Sum of return codes from the eigenvalue computation.

Referenced by eval().

double QqpDualFunc::eval_mod_con ( int  con_nr  )  const [protected]

Evaluates a modified constraint.

Parameters:
con_nr The number of the constraint to evaluate.
Returns:
The value of the constraint.

double QqpDualFunc::eval_mod_obj (  )  const [protected]

Evaluates the modified objective.

Returns:
The value of the objective.

void QqpDualFunc::set_subgrad (  )  const [protected]

Compute a subgradient of the dual function.

The subgradient is stored in subgrad.

See also:
eval_mod_con(int)

subgrad

virtual int QqpDualFunc::valgrad ( double &  val,
UserVector< double > &  g,
const UserVector< double > &  z 
) const [virtual]

Evaluates the function value and computes the subgradient of the dual function.

Parameters:
val A double to store the value in.
g A dvector to store the subgradient in.
z The dual value to compute the value and subgradient for.
Returns:
Return code from set_dual_val().
See also:
set_dual_val()

set_subgrad()

Reimplemented from Func.

Referenced by grad().

double QqpDualFunc::eval ( const UserVector< double > &  z  )  const [inline, virtual]

Evaluates this function for a dvector.

Sets dual_point to given point and calls set_dual_val(). This method doesn't look at the return value from set_dual_val() !

Parameters:
z The dvector to compute the value for.
Returns:
The value of this function.
See also:
valgrad(double&, dvector&, dvector&)

Implements Func.

Definition at line 364 of file dualqqp.h.

References Func::dim(), UserVector< Type >::dim(), dual_point, dual_val, and set_dual_val().

Referenced by get_dual_point(), get_dual_val(), and get_orig_point().

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

Computes the gradient of this function.

Calls valgrad(). This method doesn't look at the return value from set_dual_val(), so use valgrad() instead !

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

Implements Func.

Definition at line 389 of file dualqqp.h.

References valgrad().

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

Does nothing.

Implements Func.

Definition at line 406 of file dualqqp.h.

dvector QqpDualFunc::get_dual_point (  )  const [virtual]

The last dual point of the original qqp.

Returns:
The dual point of the not-extended(!) QQP, used in the last iteration.

Implements DualFunc.

Referenced by get_dual_point().

dvector QqpDualFunc::get_dual_point ( dvector ext_dual_point  )  const [inline]

The dual point of the original qqp for an extended dual point.

If the extended dual point (the one, you can use for eval()) is not equal to dual_point, eval(ext_dual_point) is called. Then get_dual_point() is called.

Parameters:
ext_dual_point A dual point from the extended qqp.
See also:
get_dual_point()

Definition at line 425 of file dualqqp.h.

References dual_point, eval(), and get_dual_point().

double QqpDualFunc::get_dual_val (  )  const [inline, virtual]

The last dual value.

Returns:
The dual value, used in the last iteration.

Implements DualFunc.

Definition at line 433 of file dualqqp.h.

References dual_val.

Referenced by get_dual_val().

double QqpDualFunc::get_dual_val ( dvector ext_dual_point  )  const [inline]

The dual value for an extended dual point.

If the extended dual point (the one, you can use for eval()) is not equal to dual_point, eval(ext_dual_point) is called. Then get_dual_val() is called.

Parameters:
ext_dual_point A dual point from the extended qqp.
See also:
get_dual_val()

Definition at line 441 of file dualqqp.h.

References dual_point, eval(), and get_dual_val().

dvector QqpDualFunc::get_orig_point ( int  use_eig_vec = 0  )  const [virtual]

Gives the solution point of the Lagrangian function.

Parameters:
use_eig_vec The eigenvector to use to compute the lag-point.
Returns:
The solution point of the Lagrangian function, used in the last iteration.

Implements DualFunc.

Referenced by get_orig_point().

dvector QqpDualFunc::get_orig_point ( dvector ext_dual_point,
int  use_eig_vec = 0 
) const [inline]

The dual value for an extended dual point.

If the extended dual point (the one, you can use for eval()) is not equal to dual_point, eval(ext_dual_point) is called. Then get_orig_point() is called.

Parameters:
ext_dual_point A dual point from the extended qqp.
See also:
get_orig_point()

Definition at line 458 of file dualqqp.h.

References dual_point, eval(), and get_orig_point().

int QqpDualFunc::nr_of_orig_points (  )  const [inline, virtual]

The number of eigenvectors, which are computed in each evaluation.

Returns:
The size of eig_vec.

Reimplemented from DualFunc.

Definition at line 466 of file dualqqp.h.

References eig_vec.

void QqpDualFunc::print ( ostream &  out  )  const [virtual]

Print's a lot of information about this function.

Parameters:
out The ostream to print to.

Reimplemented from Func.


Friends And Related Function Documentation

friend class QqpMatrix [friend]

Definition at line 101 of file dualqqp.h.

friend class QqpExtMatrix [friend]

Definition at line 102 of file dualqqp.h.


Member Data Documentation

vector<b_type> QqpDualFunc::block_type [protected]

Indicates for each block, which type the block of the lagrange problem has.

QUAD, EXTQUAD or LIN. Initialized in init_ext.

See also:
init_ext()

init()

Definition at line 120 of file dualqqp.h.

ivector QqpDualFunc::i_ext [protected]

The indices of the new quadratic box constraints.

Definition at line 124 of file dualqqp.h.

int QqpDualFunc::num_ext [protected]

The number of extended blocks.

Definition at line 128 of file dualqqp.h.

Referenced by num_qbox().

ivector QqpDualFunc::i_q [protected]

The index of the start of the quadratric box constraints for the k-th block.

Size of i_q: number of nonlinear-blocks.

Definition at line 133 of file dualqqp.h.

int QqpDualFunc::n_q [protected]

The number of quadratic variables.

Definition at line 137 of file dualqqp.h.

Referenced by num_qbox().

dvector QqpDualFunc::mid_point [protected]

The mid point of the box = 0.5*(lower+upper).

Initialized in init, should be deleted.

See also:
init()

Definition at line 143 of file dualqqp.h.

BlockMatrix QqpDualFunc::W [protected]

The half-length of the edges of the box.

Initialized in init as BlockMatrix of DiagMatrix-blocks.

See also:
init()

Definition at line 149 of file dualqqp.h.

dvector QqpDualFunc::radius [protected]

The radius of the ball-constraints.

Definition at line 153 of file dualqqp.h.

vector<bool> QqpDualFunc::ball_con [protected]

The type of the ball-constraints.

False if equality constraint and true if inequality constraint. Initialized in set_ball_con.

See also:
set_ball_con()

init()

Definition at line 161 of file dualqqp.h.

vector<dvector> QqpDualFunc::b_con [protected]

The modified b-values for the constraints.

Size set and initialized in set_bc.

See also:
set_bc()

Definition at line 175 of file dualqqp.h.

dvector QqpDualFunc::b_obj [protected]

The modified b-value for the objective-function.

Set in set_bc.

See also:
set_bc()

Definition at line 181 of file dualqqp.h.

dvector QqpDualFunc::c_con [protected]

The modified c-values for the constraints.

Size set and initialized in set_bc.

See also:
set_bc()

Definition at line 187 of file dualqqp.h.

double QqpDualFunc::c_obj [protected]

The modified c-value for the objective-function.

Set in set_bc.

See also:
set_bc()

Definition at line 193 of file dualqqp.h.

vector<Pointer<UserMatrix> > QqpDualFunc::A_lag [protected]

The block matrices of the modified Lagrangian Set in init.

See also:
init()

Definition at line 199 of file dualqqp.h.

vector<dvector> QqpDualFunc::b_lag [mutable, protected]

The linear part of the modified Lagrangian Set in init.

See also:
set_dual_val()

Definition at line 205 of file dualqqp.h.

double QqpDualFunc::c_lag [mutable, protected]

The constant part of the modified Lagrangian Set in init.

See also:
set_dual_val()

Definition at line 211 of file dualqqp.h.

dvector QqpDualFunc::x_lag [mutable, protected]

The Lagrange solution.

See also:
set_subgrad()

Definition at line 216 of file dualqqp.h.

double QqpDualFunc::dual_val [mutable, protected]

current value of the dual function.

Definition at line 220 of file dualqqp.h.

Referenced by eval(), and get_dual_val().

dvector QqpDualFunc::subgrad [mutable, protected]

The subgradient.

Definition at line 224 of file dualqqp.h.

vector<vector<double> > QqpDualFunc::eig_val [mutable, protected]

minimal eigenvalues of A_lag[k], k=0,.

.,block_size-1. eig_val[k] are the first eig_val[k].size() eigenvalues of the k'th block, starting with the smallest.

Definition at line 228 of file dualqqp.h.

vector<vector<dvector> > QqpDualFunc::eig_vec [mutable, protected]

eigenvectors of A_lag[k], k=0,.

.,block_size-1. eig_vec[k] are the first eig_vec[k].size() eigenvectors of the k'th block, starting with the one, belong to the smallest eigenvalue.

Definition at line 232 of file dualqqp.h.

Referenced by nr_of_orig_points().

int QqpDualFunc::num_matmult

number of matrix vector multiplications

Definition at line 318 of file dualqqp.h.

double QqpDualFunc::eig_time [mutable]

time spent by the eigenvalue calculation

Definition at line 320 of file dualqqp.h.

dvector QqpDualFunc::dual_point [mutable]

The dual variables of the extended (!) dual function.

This is the dual point, which was last used to evaluate the function.

See also:
get_dual_point()

Definition at line 326 of file dualqqp.h.

Referenced by eval(), get_dual_point(), get_dual_val(), and get_orig_point().


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