1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
#include "mtt_Solver.hh"
class HJ_Solver : public Solver {
// http://www.netlib.org/opt/hooke.c
// Hooke and Jeeves solution
public:
HJ_Solver (sys_ae ae,
const int npar,
const int nu,
const int nx,
const int ny,
const int nyz)
: Solver (ae,npar,nu,nx,ny,nyz)
{ static_ptr = this; VARS = nyz; };
static double
f (double tryUi[], int nyz);
~HJ_Solver (void) {};
protected:
void
Solve (void);
double
best_nearby (double delta[],
double point[],
double prevbest,
int nvars);
int
hooke (int nvars, // MTTNYZ
double startpt[], // user's initial guess
double endpt[], // result
double rho = 0.05, // geometric shrink factor
double epsilon = 1e-3, // end value stepsize
int itermax = 5000); // max # iterations
private:
int VARS;
public:
static HJ_Solver *static_ptr;
};
|
>
>
>
>
|
>
>
>
|
|
|
|
|
|
<
|
|
|
|
|
|
>
|
>
>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
>
>
>
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
#ifndef MTT_HJSOLVER
#define MTT_HJSOLVER
#include "mtt_AlgebraicSolver.hh"
namespace MTT
{
class HJ_Solver : public MTT::AlgebraicSolver
{
// http://www.netlib.org/opt/hooke.c
// Hooke and Jeeves solution
public:
HJ_Solver (const int npar,
const int nu,
const int nx,
const int ny,
const int nyz)
: MTT::AlgebraicSolver (npar,nu,nx,ny,nyz)
{
static_ptr = this;
VARS = nyz;
}
static double
f (double tryUi[], int nyz);
~HJ_Solver (void) {};
protected:
void
Solve (void);
double
best_nearby (double delta[],
double point[],
double prevbest,
int nvars);
int
hooke (int nvars, // MTTNYZ
double startpt[], // user's initial guess
double endpt[], // result
double rho = 0.05, // geometric shrink factor
double epsilon = 1e-3, // end value stepsize
int itermax = 5000); // max # iterations
private:
int VARS;
public:
static HJ_Solver *static_ptr;
};
}
#endif // MTT_HJSOLVER
|