Go to the documentation of this file.
11 int (*
f)(
double*,
double*),
int (*
df)(
double*,
double*),
12 int (*
g)(
double*,
double*),
int (*
dg)(
double*,
double*),
13 int (*
h)(
double*,
double*),
int (*
dh)(
double*,
double*),
15 double ftol,
double xtol,
double eqthre,
int max_eval,
double max_time,
41 static void my_log(std::string comment) {
42 std::cout << comment << std::endl ;
45 static void my_log(std::string comment,
double val){
46 std::ostringstream os;
49 std::cout << os.str() << std::endl ;
52 static void my_log(std::string comment,
double* val, uint cnt){
53 std::ostringstream os;
55 if ( val && cnt > 0 ){
56 for ( uint i=0; i<cnt ; i++ ){
60 std::cout << os.str() << std::endl ;
63 static void my_copy(
double* in,
double* out,
int size){
64 for ( uint i=0 ; i<size ; i++ ){
70 if(
result == NLOPT_SUCCESS)
74 else if(
result == NLOPT_FTOL_REACHED)
76 my_log(
"Succeed: Relative tolerance on function value was reached. ");
78 else if(
result == NLOPT_XTOL_REACHED)
80 my_log(
"Succeed: Relative tolerance on optimization parameters was reached. ");
82 else if(
result == NLOPT_MAXEVAL_REACHED)
84 my_log(
"Succeed: Maximum number of function evaluations was reached. ");
86 else if(
result == NLOPT_MAXTIME_REACHED)
88 my_log(
"Succeed: Maximum optimization time was reached. ");
90 else if(
result == NLOPT_FAILURE)
94 else if(
result == NLOPT_INVALID_ARGS)
96 my_log(
"Fail: Invalid arguments.");
98 else if(
result == NLOPT_OUT_OF_MEMORY)
100 my_log(
"Fail: Run out of memory.");
102 else if(
result == NLOPT_ROUNDOFF_LIMITED)
104 my_log(
"Fail: Roundoff errors limited progress.");
114 my_log(
"object function: ", this->fbuf[0]) ;
115 my_log(
" | where x: ", this->x, this->m_x) ;
117 my_log(
" | eq constt: ", this->gbuf, this->m_g) ;
119 my_log(
" | neq constt: ", this->hbuf, this->m_h) ;
123 nlopt_force_stop(this->
solver) ;
130 int (*
f)(
double*,
double*), (*
df)(
double*,
double*);
132 int (*
g)(
double*,
double*), (*
dg)(
double*,
double*);
134 int (*
h)(
double*,
double*), (*
dh)(
double*,
double*);
static void my_log(std::string comment, double val)
static void my_log(std::string comment, double *val, uint cnt)
int(* f)(double *, double *)
unsigned int m_g
等式制約条件の次元
int(*)(*) df(double *, double *)
void InequalityConstraintCost(double *h)
不等式制約条件
static void EqualityConstraintWrapper(unsigned int m, double *g, unsigned int n, const double *x, double *dg, void *self)
等式制約条件のラッパー
int(*)(*) dg(double *, double *)
unsigned int n_f
評価関数の計算回数
Algorithm
NLoptに実装されているアルゴリズム
unsigned int frequency
最適化計算の出力頻度
int(* h)(double *, double *)
不等式制約条件
void ObjectiveFunctionGradient(double *df)
評価関数の和の勾配を計算する
void InequalityConstraintGradient(double *dh)
不等式制約条件の勾配
unsigned int n_g
等式制約条件の計算回数
unsigned int n_h
不等式制約条件の計算回数
unsigned int n_dg
等式制約条件の勾配の計算回数
NLoptSolver(double *x, const double *x_min, const double *x_max, int(*f)(double *, double *), int(*df)(double *, double *), int(*g)(double *, double *), int(*dg)(double *, double *), int(*h)(double *, double *), int(*dh)(double *, double *), int m_x, int m_g, int m_h, double ftol, double xtol, double eqthre, int max_eval, double max_time, Optimization::NLopt::Algorithm algorithm)
static void my_copy(double *in, double *out, int size)
static double ObjectiveFunctionWrapper(unsigned int n, const double *x, double *df, void *self)
評価関数のラッパー
unsigned int n_dh
不等式制約条件の勾配の計算回数
void EqualityConstraintGradient(double *dg)
等式制約条件の勾配
void output_result(int result)
unsigned int m_h
不等式制約条件の次元
static void InequalityConstraintWrapper(unsigned int m, double *h, unsigned int n, const double *x, double *dh, void *self)
不等式制約条件のラッパー
unsigned int n_df
評価関数の勾配の計算回数
int(* g)(double *, double *)
等式制約条件
double ObjectiveFunctionCost()
評価関数の和を計算する
void EqualityConstraintCost(double *g)
等式制約条件
static void my_log(std::string comment)
unsigned int iteration
最適化計算のイテレーション数
int(*)(*) dh(double *, double *)
eus_nlopt
Author(s):
autogenerated on Mon Dec 9 2024 04:10:43