PLearn 0.1
|
#include <ExplicitListOracle.h>
Public Types | |
typedef OptionsOracle | inherited |
Public Member Functions | |
ExplicitListOracle () | |
virtual TVec< string > | getOptionNames () const |
returns the set of names of options this generator generates | |
virtual TVec< string > | generateNextTrial (const TVec< string > &older_trial, real obtained_objective) |
virtual void | forget () |
SUBCLASS WRITING: Should reset the generator's internal state (as having no info about previous trials). | |
virtual void | build () |
Post-constructor. | |
virtual void | makeDeepCopyFromShallowCopy (CopiesMap &copies) |
Transforms a shallow copy into a deep copy. | |
virtual string | classname () const |
virtual OptionList & | getOptionList () const |
virtual OptionMap & | getOptionMap () const |
virtual RemoteMethodMap & | getRemoteMethodMap () const |
virtual ExplicitListOracle * | deepCopy (CopiesMap &copies) const |
Static Public Member Functions | |
static string | _classname_ () |
Declares name and deepCopy methods. | |
static OptionList & | _getOptionList_ () |
static RemoteMethodMap & | _getRemoteMethodMap_ () |
static Object * | _new_instance_for_typemap_ () |
static bool | _isa_ (const Object *o) |
static void | _static_initialize_ () |
static const PPath & | declaringFile () |
Public Attributes | |
TVec< string > | option_names |
name of options | |
TMat< string > | option_values |
A matrix with as many columns as there are options, giving their values. | |
Static Public Attributes | |
static StaticInitializer | _static_initializer_ |
Static Protected Member Functions | |
static void | declareOptions (OptionList &ol) |
Declares this class' options. | |
Protected Attributes | |
int | nreturned |
number of trials returned so far (This is also the index of the next trial that will get returned) | |
Private Member Functions | |
void | build_ () |
This does the actual building. |
Definition at line 52 of file ExplicitListOracle.h.
Reimplemented from PLearn::OptionsOracle.
Definition at line 65 of file ExplicitListOracle.h.
PLearn::ExplicitListOracle::ExplicitListOracle | ( | ) |
Definition at line 48 of file ExplicitListOracle.cc.
:OptionsOracle(), nreturned(0) /* ### Initialise all fields to their default value */ { // ... // ### You may or may not want to call build_() to finish building the object // build_(); }
string PLearn::ExplicitListOracle::_classname_ | ( | ) | [static] |
Declares name and deepCopy methods.
Reimplemented from PLearn::OptionsOracle.
Definition at line 59 of file ExplicitListOracle.cc.
OptionList & PLearn::ExplicitListOracle::_getOptionList_ | ( | ) | [static] |
Reimplemented from PLearn::OptionsOracle.
Definition at line 59 of file ExplicitListOracle.cc.
RemoteMethodMap & PLearn::ExplicitListOracle::_getRemoteMethodMap_ | ( | ) | [static] |
Reimplemented from PLearn::OptionsOracle.
Definition at line 59 of file ExplicitListOracle.cc.
Reimplemented from PLearn::OptionsOracle.
Definition at line 59 of file ExplicitListOracle.cc.
Object * PLearn::ExplicitListOracle::_new_instance_for_typemap_ | ( | ) | [static] |
Reimplemented from PLearn::Object.
Definition at line 59 of file ExplicitListOracle.cc.
StaticInitializer ExplicitListOracle::_static_initializer_ & PLearn::ExplicitListOracle::_static_initialize_ | ( | ) | [static] |
Reimplemented from PLearn::OptionsOracle.
Definition at line 59 of file ExplicitListOracle.cc.
void PLearn::ExplicitListOracle::build | ( | ) | [virtual] |
Post-constructor.
The normal implementation should call simply inherited::build(), then this class's build_(). This method should be callable again at later times, after modifying some option fields to change the "architecture" of the object.
Reimplemented from PLearn::OptionsOracle.
Definition at line 107 of file ExplicitListOracle.cc.
References PLearn::OptionsOracle::build(), and build_().
{ inherited::build(); build_(); }
void PLearn::ExplicitListOracle::build_ | ( | ) | [private] |
This does the actual building.
Reimplemented from PLearn::OptionsOracle.
Definition at line 95 of file ExplicitListOracle.cc.
Referenced by build().
{ // ### This method should do the real building of the object, // ### according to set 'options', in *any* situation. // ### Typical situations include: // ### - Initial building of an object from a few user-specified options // ### - Building of a "reloaded" object: i.e. from the complete set of all serialised options. // ### - Updating or "re-building" of an object after a few "tuning" options have been modified. // ### You should assume that the parent class' build_() has already been called. }
string PLearn::ExplicitListOracle::classname | ( | ) | const [virtual] |
Reimplemented from PLearn::Object.
Definition at line 59 of file ExplicitListOracle.cc.
void PLearn::ExplicitListOracle::declareOptions | ( | OptionList & | ol | ) | [static, protected] |
Declares this class' options.
Reimplemented from PLearn::OptionsOracle.
Definition at line 61 of file ExplicitListOracle.cc.
References PLearn::OptionBase::buildoption, PLearn::declareOption(), PLearn::OptionsOracle::declareOptions(), PLearn::OptionBase::learntoption, nreturned, option_names, and option_values.
{ declareOption(ol, "option_names", &ExplicitListOracle::option_names, OptionBase::buildoption, "name of options"); declareOption(ol, "option_values", &ExplicitListOracle::option_values, OptionBase::buildoption, "A matrix with as many columns as there are options, giving their values"); declareOption(ol, "nreturned", &ExplicitListOracle::nreturned, OptionBase::learntoption, "The number of returned option"); // Now call the parent class' declareOptions inherited::declareOptions(ol); }
static const PPath& PLearn::ExplicitListOracle::declaringFile | ( | ) | [inline, static] |
Reimplemented from PLearn::OptionsOracle.
Definition at line 113 of file ExplicitListOracle.h.
ExplicitListOracle * PLearn::ExplicitListOracle::deepCopy | ( | CopiesMap & | copies | ) | const [virtual] |
Reimplemented from PLearn::OptionsOracle.
Definition at line 59 of file ExplicitListOracle.cc.
void PLearn::ExplicitListOracle::forget | ( | ) | [virtual] |
SUBCLASS WRITING: Should reset the generator's internal state (as having no info about previous trials).
Implements PLearn::OptionsOracle.
Definition at line 88 of file ExplicitListOracle.cc.
References nreturned.
{ nreturned = 0; }
TVec< string > PLearn::ExplicitListOracle::generateNextTrial | ( | const TVec< string > & | older_trial, |
real | obtained_objective | ||
) | [virtual] |
SUBCLASS WRITING: This notifies the oracle, of the result obtained for a previous trial it suggested. The oracle is expected to return the next suggestion, or an empty vector if stopping conditions were met, or it run out of suggestions. An empty vector may be passed for older_trial if there is no result to report.
Implements PLearn::OptionsOracle.
Definition at line 80 of file ExplicitListOracle.cc.
References PLearn::TMat< T >::length(), nreturned, and option_values.
{ if(nreturned < option_values.length()) return option_values(nreturned++); else return TVec<string>(); }
OptionList & PLearn::ExplicitListOracle::getOptionList | ( | ) | const [virtual] |
Reimplemented from PLearn::Object.
Definition at line 59 of file ExplicitListOracle.cc.
OptionMap & PLearn::ExplicitListOracle::getOptionMap | ( | ) | const [virtual] |
Reimplemented from PLearn::Object.
Definition at line 59 of file ExplicitListOracle.cc.
TVec< string > PLearn::ExplicitListOracle::getOptionNames | ( | ) | const [virtual] |
returns the set of names of options this generator generates
Implements PLearn::OptionsOracle.
Definition at line 77 of file ExplicitListOracle.cc.
References option_names.
{ return option_names; }
RemoteMethodMap & PLearn::ExplicitListOracle::getRemoteMethodMap | ( | ) | const [virtual] |
Reimplemented from PLearn::Object.
Definition at line 59 of file ExplicitListOracle.cc.
void PLearn::ExplicitListOracle::makeDeepCopyFromShallowCopy | ( | CopiesMap & | copies | ) | [virtual] |
Transforms a shallow copy into a deep copy.
Reimplemented from PLearn::OptionsOracle.
Definition at line 114 of file ExplicitListOracle.cc.
References PLearn::deepCopyField(), PLearn::OptionsOracle::makeDeepCopyFromShallowCopy(), option_names, and option_values.
{ inherited::makeDeepCopyFromShallowCopy(copies); deepCopyField(option_names, copies); deepCopyField(option_values, copies); }
Reimplemented from PLearn::OptionsOracle.
Definition at line 113 of file ExplicitListOracle.h.
int PLearn::ExplicitListOracle::nreturned [protected] |
number of trials returned so far (This is also the index of the next trial that will get returned)
Definition at line 61 of file ExplicitListOracle.h.
Referenced by declareOptions(), forget(), and generateNextTrial().
name of options
Definition at line 71 of file ExplicitListOracle.h.
Referenced by declareOptions(), getOptionNames(), and makeDeepCopyFromShallowCopy().
A matrix with as many columns as there are options, giving their values.
Definition at line 72 of file ExplicitListOracle.h.
Referenced by declareOptions(), generateNextTrial(), and makeDeepCopyFromShallowCopy().