Loading...
Searching...
No Matches
gpr::neb::ActiveLearningSession::PolicyScope Class Reference

#include <gpr/neb/Session.h>

Public Member Functions

 PolicyScope (ActiveLearningSession *session, const policy::TrainingPolicy *policy, policy::SearchKind kind=policy::SearchKind::Neb)
 ~PolicyScope () noexcept
 PolicyScope (const PolicyScope &)=delete
PolicyScope & operator= (const PolicyScope &)=delete
 PolicyScope (PolicyScope &&other) noexcept
PolicyScope & operator= (PolicyScope &&)=delete
void publishProgress (int iteration, int oracle_calls, int refits, int training_size) noexcept

Detailed Description

RAII guard binding a TrainingPolicy and SearchKind to an ActiveLearningSession for the duration of a search phase and restoring any enclosing PolicyContext on scope exit.

Definition at line 3228 of file Session.h.

Constructor & Destructor Documentation

◆ PolicyScope() [1/3]

gpr::neb::ActiveLearningSession::PolicyScope::PolicyScope ( ActiveLearningSession * session,
const policy::TrainingPolicy * policy,
policy::SearchKind kind = policy::SearchKind::Neb )
inline

Definition at line 3230 of file Session.h.

3233 {
3234 if (session == nullptr || policy == nullptr) return;
3235 session_ = session;
3236 previous_ = std::move(session_->policy_context_);
3237 auto ctx = std::make_shared<policy::PolicyContext>();
3238 ctx->policy = policy;
3239 ctx->kind = kind;
3240 session_->policy_context_ = std::move(ctx);
3241 }

◆ ~PolicyScope()

gpr::neb::ActiveLearningSession::PolicyScope::~PolicyScope ( )
inlinenoexcept

Definition at line 3243 of file Session.h.

3244 {
3245 if (session_ != nullptr) {
3246 session_->policy_context_ = std::move(previous_);
3247 }
3248 }

◆ PolicyScope() [2/3]

gpr::neb::ActiveLearningSession::PolicyScope::PolicyScope ( const PolicyScope & )
delete

◆ PolicyScope() [3/3]

gpr::neb::ActiveLearningSession::PolicyScope::PolicyScope ( PolicyScope && other)
inlinenoexcept

Definition at line 3253 of file Session.h.

3254 : session_(other.session_), previous_(std::move(other.previous_))
3255 {
3256 other.session_ = nullptr;
3257 }

Member Function Documentation

◆ operator=() [1/2]

PolicyScope & gpr::neb::ActiveLearningSession::PolicyScope::operator= ( const PolicyScope & )
delete

◆ operator=() [2/2]

PolicyScope & gpr::neb::ActiveLearningSession::PolicyScope::operator= ( PolicyScope && )
delete

◆ publishProgress()

void gpr::neb::ActiveLearningSession::PolicyScope::publishProgress ( int iteration,
int oracle_calls,
int refits,
int training_size )
inlinenoexcept

Definition at line 3261 of file Session.h.

3263 {
3264 if (session_ != nullptr) {
3265 session_->publishPolicyProgress(iteration, oracle_calls, refits,
3266 training_size);
3267 }
3268 }

The documentation for this class was generated from the following file: