-
Notifications
You must be signed in to change notification settings - Fork 1
/
t-newuoa.cc
54 lines (39 loc) · 1.03 KB
/
t-newuoa.cc
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
///////////////////////////////////////////////////////////////////////////////
#include <lvv/lvv.h>
#include <lvv/math.h>
using lvv::pow2;
#include <lvv/array.h>
using lvv::array;
using lvv::matrix;
#include <lopti/newuoa-wrap.h>
using namespace lopti;
int main(int argc, char **argv) {
#if ! defined(FN)
#define FN rosenbrock
#endif
#define RHO_BEGIN 0.2
#define RHO_END 1e-4
#if ! defined(_N)
#define _N 2
#endif
#if ! defined(ITER)
#define ITER 1000
#endif
typedef array<double,_N,1> V1;
typedef array<double,_N,0> V0;
{ cout << "***** ANY V ****** \n";
typedef array<float,2,0> V;
V X0 = {{ -1.2, -1 }};
newuoa_minimizer<V> mzr; //// NEWUOA : 2*N + 1
//mzr .objective (xg_log<V>(FN<V>(),mzr));
mzr .objective (trace<V>(FN<V>()));
mzr .x0 (X0); // X[1..N]
mzr .rho_begin (RHO_BEGIN);
mzr .rho_end (RHO_END);
mzr .max_iter (ITER);
//mzr .verbose (true);
V X_opt = mzr.argmin();
mzr .print ();
}
return 0;
}