OverSim
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
simplex.h
Go to the documentation of this file.
1
/* Numerical Methods, S06
2
* Note 8, Function optimization using the downhill simplex method.
3
* Peter Seidler */
4
5
#ifndef _SIMPLEX_H_
6
#define _SIMPLEX_H_
7
8
#include "
yang.h
"
9
10
11
// forward declarations
12
class
CoordCalcFunction
;
13
14
15
16
class
Simplex
17
{
18
private
:
19
int
nverts
;
// Number of vertices.
20
Vec_DP
**
verts
;
// Array of pointers to vertices.
21
int
dim
;
// Dimension of points.
22
23
public
:
24
CoordCalcFunction
*
functionObject
;
25
26
Simplex
(
int
dimension);
27
~Simplex
();
28
29
Vec_DP
&
operator[]
(
int
i)
const
{
return
*
verts
[i];}
30
31
// Returns different characteristic properties.
32
int
high
(
double
* val = 0)
const
;
33
int
low
(
double
* val = 0)
const
;
34
void
centroid
(
Vec_DP
& vec)
const
;
35
double
size
()
const
;
36
37
// Operations that can be performed on simplex.
38
int
reflect
();
// Returns index of vertex reflected.
39
int
reflect_exp
();
// Returns index of vertex reflected.
40
int
contract
();
// Returns index of vertex contracted.
41
void
reduce
();
42
};
43
44
/* Finds minimum of f using the downhill simplex method.
45
* init: Initial guess on minimum.
46
* res: Point of calculated minimum.
47
* accf: Desired accuracy: Max diff. between function values at highest
48
* and lowest point of simplex. On return the variable
49
* is updated with the actual difference.
50
* accx: Desired accuracy: Max size of simplex. On return updated with
51
* actual size.
52
* nmax: Max no. of iterations. On return updated with actual no.
53
* of iterations.
54
* Return value: Function value at minimum. */
55
56
57
#endif // _SIMPLEX_H
src
common
cbr
simplex.h
Generated on Fri Dec 7 2012 13:37:53 for OverSim by
1.8.1.2