本文整理汇总了C++中nomad::Eval_Point::set方法的典型用法代码示例。如果您正苦于以下问题:C++ Eval_Point::set方法的具体用法?C++ Eval_Point::set怎么用?C++ Eval_Point::set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nomad::Eval_Point
的用法示例。
在下文中一共展示了Eval_Point::set方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Exception
/*-------------------------------------------------------------*/
void NOMAD::Speculative_Search::search ( NOMAD::Mads & mads ,
int & nb_search_pts ,
bool & stop ,
NOMAD::stop_type & stop_reason ,
NOMAD::success_type & success ,
bool & count_search ,
const NOMAD::Eval_Point *& new_feas_inc ,
const NOMAD::Eval_Point *& new_infeas_inc )
{
// new_feas_inc and new_infeas_inc are used as inputs,
// so do not initialize them to NULL here
nb_search_pts = 0;
success = NOMAD::UNSUCCESSFUL;
count_search = !stop;
if ( stop )
return;
const NOMAD::Display & out = _p.out();
NOMAD::dd_type display_degree = out.get_search_dd();
if ( display_degree == NOMAD::FULL_DISPLAY ) {
std::ostringstream oss;
oss << NOMAD::SPEC_SEARCH;
out << std::endl << NOMAD::open_block ( oss.str() ) << std::endl;
}
int lkm1; // l_{k-1}
int lk; // l_k
int n;
NOMAD::Signature * signature;
NOMAD::Point delta_m_k;
NOMAD::Point delta_m_km1;
NOMAD::Point factor;
NOMAD::Point xkm1;
NOMAD::Eval_Point * sk;
const NOMAD::Eval_Point * x[2];
x[0] = new_feas_inc;
x[1] = new_infeas_inc;
// Evaluator_Control:
NOMAD::Evaluator_Control & ev_control = mads.get_evaluator_control();
for ( int i = 0 ; i < 2 ; ++i ) {
if ( x[i] && x[i]->get_mesh_index() ) {
const NOMAD::Direction * dir = x[i]->get_direction();
if ( dir && ( dir->is_mads() || dir->get_type()==NOMAD::MODEL_SEARCH_DIR ) ) {
// get the x_k's signature:
signature = x[i]->get_signature();
if ( !signature )
throw NOMAD::Exception ( "Speculative_Search.cpp" , __LINE__ ,
"Speculative_Search::search(): could not get the signature" );
xkm1 = *x[i] - *dir;
lk = lkm1 = *x[i]->get_mesh_index();
NOMAD::Mesh::update ( NOMAD::FULL_SUCCESS , lk );
n = signature->get_n();
delta_m_k = NOMAD::Point ( n );
delta_m_km1 = NOMAD::Point ( n );
factor = NOMAD::Point ( n );
signature->get_mesh().get_delta_m ( delta_m_k , lk );
signature->get_mesh().get_delta_m ( delta_m_km1 , lkm1 );
// multiplicative factor: takes into account the fact that
// the direction contains \Delta^m_k:
try {
// factor = delta_m_k / delta_m_km1 :
for ( int k = 0 ; k < n ; ++k ) {
if ( delta_m_k[k].is_defined() && delta_m_km1[k].is_defined() &&
delta_m_k[k].value() != 0.0 && delta_m_km1[k].value() != 0.0 )
factor[k] = delta_m_k[k] / delta_m_km1[k];
else
factor[k] = 0.0;
}
}
catch ( NOMAD::Double::Invalid_Value & ) {
if ( display_degree == NOMAD::FULL_DISPLAY )
out << "could not compute " << _type << " point: stop" << std::endl
<< NOMAD::close_block ( "end of speculative search" );
stop = true;
stop_reason = NOMAD::MESH_PREC_REACHED;
return;
}
if ( lkm1 <= 0 )
factor *= NOMAD::Mesh::get_mesh_update_basis();
// speculative search point:
NOMAD::Direction new_dir ( n , 0.0 , dir->get_type() );
new_dir.Point::operator = ( factor * *dir );
sk = new NOMAD::Eval_Point;
sk->set ( n , _p.get_bb_nb_outputs() );
//.........这里部分代码省略.........