本文整理汇总了C++中nomad::Eval_Point::get_f方法的典型用法代码示例。如果您正苦于以下问题:C++ Eval_Point::get_f方法的具体用法?C++ Eval_Point::get_f怎么用?C++ Eval_Point::get_f使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nomad::Eval_Point
的用法示例。
在下文中一共展示了Eval_Point::get_f方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
/*---------------------------------------------------------*/
NOMAD::success_type NOMAD::Barrier::insert_feasible ( const NOMAD::Eval_Point & x )
{
if ( !_best_feasible || ( x.get_f().value() < _best_feasible->get_f().value() ) ) {
_best_feasible = &x;
return NOMAD::FULL_SUCCESS;
}
return NOMAD::UNSUCCESSFUL;
}
示例2:
/*---------------------------------------------------------*/
NOMAD::success_type NOMAD::Barrier::insert_infeasible ( const NOMAD::Eval_Point & x )
{
const NOMAD::Eval_Point * old_bi = get_best_infeasible();
// filter insertion:
// -----------------
bool insert;
filter_insertion ( x , insert );
// filter:
// -------
if ( _p.get_barrier_type() == NOMAD::FILTER )
{
const NOMAD::Eval_Point * bi = get_best_infeasible();
if ( !bi )
return NOMAD::UNSUCCESSFUL;
if ( old_bi )
{
if ( bi->get_h().value() < old_bi->get_h().value() )
return NOMAD::FULL_SUCCESS;
if ( insert )
return NOMAD::PARTIAL_SUCCESS;
return NOMAD::UNSUCCESSFUL;
}
return NOMAD::FULL_SUCCESS;
}
// progressive barrier:
// --------------------
// with PEB constraints, we remember all points that we tried to insert:
if ( _p.get_barrier_type() == NOMAD::PEB_P )
_peb_lop.push_back ( &x );
// first infeasible successes are considered as partial successes
// (improving iterations)
if ( !_ref )
return NOMAD::PARTIAL_SUCCESS;
double hx = x.get_h().value();
double fx = x.get_f().value();
double hr = _ref->get_h().value();
double fr = _ref->get_f().value();
// failure:
if ( hx > hr || ( hx == hr && fx >= fr ) )
return NOMAD::UNSUCCESSFUL;
// partial success:
if ( fx > fr )
return NOMAD::PARTIAL_SUCCESS;
// full success:
return NOMAD::FULL_SUCCESS;
}
示例3: Exception
/*---------------------------------------------------------*/
NOMAD::success_type NOMAD::Barrier::insert_feasible ( const NOMAD::Eval_Point & x )
{
Double fx;
Double fx_bf;
if ( _p.get_robust_mads() )
{
if ( x.get_smoothing_status() != NOMAD::SMOOTHING_OK )
return NOMAD::UNSUCCESSFUL;
if ( _best_feasible )
fx_bf = _best_feasible->get_fsmooth();
else
{
_best_feasible = &x;
return NOMAD::FULL_SUCCESS;
}
fx = x.get_fsmooth();
}
else
{
if ( _best_feasible )
fx_bf = _best_feasible->get_f();
else
{
_best_feasible = &x;
return NOMAD::FULL_SUCCESS;
}
fx= x.get_f();
}
if ( !fx.is_defined() || ! fx_bf.is_defined() )
throw NOMAD::Exception ( __FILE__ , __LINE__ ,
"insert_feasible(): one point has no f value" );
if ( fx.value() < fx_bf.value() )
{
_best_feasible = &x;
return NOMAD::FULL_SUCCESS;
}
return NOMAD::UNSUCCESSFUL;
}
示例4: Insert_Error
/*---------------------------------------------------------*/
void NOMAD::Barrier::insert ( const NOMAD::Eval_Point & x )
{
// we compare the eval types (_SGTE_ or _TRUTH_) of x and *this:
if ( x.get_eval_type() != _eval_type )
throw Barrier::Insert_Error ( "Barrier.cpp" , __LINE__ ,
"insertion of an Eval_Point into the bad Barrier object" );
// basic check:
if ( !x.is_eval_ok() )
{
_one_eval_succ = NOMAD::UNSUCCESSFUL;
return;
}
// pre-filter: if tag(x) is already in the pre-filter,
// then return _UNSUCCESSFUL_:
size_t size_before = _prefilter.size();
_prefilter.insert ( x.get_tag() );
if ( _prefilter.size() == size_before )
{
_one_eval_succ = NOMAD::UNSUCCESSFUL;
return;
}
// insertion in _all_inserted:
_all_inserted.push_back ( &x );
// other checks:
const NOMAD::Double & h = x.get_h();
if ( !x.is_EB_ok () ||
!x.get_f().is_defined () ||
!h.is_defined () ||
h.value() > _h_max.value() )
{
_one_eval_succ = NOMAD::UNSUCCESSFUL;
return;
}
// insert_feasible or insert_infeasible:
_one_eval_succ = ( x.is_feasible ( _p.get_h_min() ) ) ?
insert_feasible ( x ) : insert_infeasible(x);
if ( _one_eval_succ > _success )
_success = _one_eval_succ;
}