FOX/ObjCryst++  1.10.X (development)
ObjCryst::SimplexObj Class Reference

Conjugate Gradient Algorithm object. More...

+ Inheritance diagram for ObjCryst::SimplexObj:
+ Collaboration diagram for ObjCryst::SimplexObj:

Public Member Functions

 SimplexObj (const string name="Unnamed Simplex Object")
 Constructor.
 
virtual void Optimize (long &nbSteps, const bool silent=false, const REAL finalcost=0, const REAL maxTime=-1)
 Launch optimization (a single run) for N steps. More...
 
virtual void MultiRunOptimize (long &nbCycle, long &nbSteps, const bool silent=false, const REAL finalcost=0, const REAL maxTime=-1)
 Launch optimization for multiple runs of N steps. More...
 
virtual void XMLOutput (ostream &os, int indent=0) const
 Output a description of the object in XML format to a stream. More...
 
virtual void XMLInput (istream &is, const XMLCrystTag &tag)
 Input in XML format from a stream, restoring the set of refined objects and the associated cost functions. More...
 
- Public Member Functions inherited from ObjCryst::OptimizationObj
 OptimizationObj (const string name="")
 Constructor.
 
virtual ~OptimizationObj ()
 Destructor.
 
virtual void RandomizeStartingConfig ()
 Randomize starting configuration. More...
 
void FixAllPar ()
 Fix all parameters.
 
void SetParIsFixed (const string &parName, const bool fix)
 Fix one parameter.
 
void SetParIsFixed (const RefParType *type, const bool fix)
 Fix one family of parameters.
 
void UnFixAllPar ()
 UnFix All parameters.
 
void SetParIsUsed (const string &parName, const bool use)
 Set a parameter to be used.
 
void SetParIsUsed (const RefParType *type, const bool use)
 Set a family of parameters to be used.
 
void SetLimitsRelative (const string &parName, const REAL min, const REAL max)
 Change the relative limits for a parameter from its name.
 
void SetLimitsRelative (const RefParType *type, const REAL min, const REAL max)
 Change the relative limits for a family of parameter.
 
void SetLimitsAbsolute (const string &parName, const REAL min, const REAL max)
 Change the absolute limits for a parameter from its name.
 
void SetLimitsAbsolute (const RefParType *type, const REAL min, const REAL max)
 Change the absolute limits for a family of parameter.
 
virtual REAL GetLogLikelihood () const
 The optimized (minimized, actually) function. More...
 
void StopAfterCycle ()
 Stop after the current cycle. USed for interactive refinement.
 
virtual void DisplayReport ()
 Show report to the user during refinement. Used for GUI update.
 
void AddRefinableObj (RefinableObj &)
 Add a refined object. All sub-objects are also added.
 
RefinableObjGetFullRefinableObj (const bool rebuild=true)
 Get the RefinableObj with all the parameters from all refined objects. More...
 
const string & GetName () const
 Get the name for this object.
 
void SetName (const string &)
 Set the name for this object.
 
virtual const string GetClassName () const
 Get the name for this class type.
 
virtual void Print () const
 Print some information about this object.
 
void RestoreBestConfiguration ()
 Restore the Best configuration.
 
bool IsOptimizing () const
 Are we busy optimizing ?
 
void TagNewBestConfig ()
 During a global optimization, tell all objects that the current config is the latest "best" config.
 
REAL GetLastOptimElapsedTime () const
 Get the elapsed time (in seconds) during the last optimization.
 
MainTrackerGetMainTracker ()
 Get the MainTracker.
 
const MainTrackerGetMainTracker () const
 Get the MainTracker.
 
RefObjOptGetXMLAutoSaveOption ()
 
const RefObjOptGetXMLAutoSaveOption () const
 
const REAL & GetBestCost () const
 Access to current best cost.
 
REAL & GetBestCost ()
 Access to current best cost.
 
virtual void BeginOptimization (const bool allowApproximations=false, const bool enableRestraints=false)
 Begin optimization for all objects.
 
virtual void EndOptimization ()
 End optimization for all objects.
 
virtual long & NbTrialPerRun ()
 Number of trial per run.
 
virtual const long & NbTrialPerRun () const
 Number of trial per run.
 

Private Member Functions

REAL GenerateNewSimplexConfiguration (CrystVector_REAL &vLLK, CrystVector_long &vIndex, unsigned long worst, REAL f)
 Try a new configuration by expanding the worst vertex from the center by a factor f. More...
 

Additional Inherited Members

- Protected Member Functions inherited from ObjCryst::OptimizationObj
void PrepareRefParList ()
 
virtual void InitOptions ()
 Initialization of options.
 
virtual void UpdateDisplay ()
 Update Display (if any display is available), when a new 'relevant' configuration is reached. More...
 
void BuildRecursiveRefObjList ()
 (Re)build OptimizationObj::mRecursiveRefinedObjList, if an object has been added or modified. More...
 
- Protected Attributes inherited from ObjCryst::OptimizationObj
RefinableObj mRefParList
 The refinable par list used during refinement. More...
 
string mName
 Name of the GlobalOptimization object.
 
string mSaveFileName
 File name where refinement info is saved (NOT USED so far...)
 
long mNbTrialPerRun
 Number of trial per run, to be saved/restored in XML output.
 
long mNbTrial
 Number of trials so far.
 
REAL mBestCost
 Best value of the cost function so far.
 
long mBestParSavedSetIndex
 Index of the 'best' saved parameter set.
 
unsigned long mContext
 The current 'context', in the case the optimization is run in different parallel contexts.
 
map< unsigned long, map< const
RefinableObj
*, LogLikelihoodStats > > 
mvContextObjStats
 Statistics for each context (mutable for dynamic update during optimization)
 
map< const RefinableObj
*, DynamicObjWeight
mvObjWeight
 Weights for each objects in each context (mutable for dynamic update during optimization)
 
std::vector< pair< long, REAL > > mvSavedParamSet
 List of saved parameter sets. More...
 
bool mIsOptimizing
 True if a refinement is being done. For multi-threaded environment.
 
bool mStopAfterCycle
 If true, then stop at the end of the cycle. Used in multi-threaded environment.
 
ObjRegistry< RefinableObjmRefinedObjList
 The refined objects.
 
ObjRegistry< RefinableObjmRecursiveRefinedObjList
 The refined objects, recursively including all sub-objects. More...
 
RefObjOpt mXMLAutoSave
 Periodic save of complete environment as an xml file.
 
REAL mLastOptimTime
 The time elapsed after the last optimization, in seconds.
 
MainTracker mMainTracker
 MainTracker object to track the evolution of cost functions, likelihood, and individual parameters. More...
 

Detailed Description

Conjugate Gradient Algorithm object.

currently does not handle parameters hitting limits, and is not very efficient (uses numerical derivatives)

Definition at line 36 of file Simplex.h.

Member Function Documentation

REAL ObjCryst::SimplexObj::GenerateNewSimplexConfiguration ( CrystVector_REAL &  vLLK,
CrystVector_long &  vIndex,
unsigned long  worst,
REAL  f 
)
private

Try a new configuration by expanding the worst vertex from the center by a factor f.

If it is better, store it as new worst. Return the new obtained llk

Definition at line 145 of file Simplex.cpp.

void ObjCryst::SimplexObj::MultiRunOptimize ( long &  nbCycle,
long &  nbSteps,
const bool  silent = false,
const REAL  finalcost = 0,
const REAL  maxTime = -1 
)
virtual

Launch optimization for multiple runs of N steps.

Parameters
nbCyclethe number of runs (cycles) to perform. The structure is randomized at the beginning of each cycle. If nbCycle==-1, this will run indefinitely. The nbCycle parameter is decreased after each run.
nbStepsthe number of steps to go. This number is modified (decreases!) as the refinement goes on.
silent: if true, absolutely no message should be printed (except debugging)
finalcostthe optimization will stop if overall cost fallse below this value
maxTimethe optimization will stop after the given number of seconds has been spent optimizing (ignored if <0).

Implements ObjCryst::OptimizationObj.

Definition at line 127 of file Simplex.cpp.

void ObjCryst::SimplexObj::Optimize ( long &  nbSteps,
const bool  silent = false,
const REAL  finalcost = 0,
const REAL  maxTime = -1 
)
virtual

Launch optimization (a single run) for N steps.

Parameters
nbStepsthe number of steps to go. This number is modified (decreases!) as the refinement goes on.
silent: if true, absolutely no message should be printed (except debugging)
finalcostthe optimization will stop if overall cost fallse below this value
maxTimethe optimization will stop after the given number of seconds has been spent optimizing (ignored if <0).

Implements ObjCryst::OptimizationObj.

Definition at line 32 of file Simplex.cpp.

void ObjCryst::SimplexObj::XMLInput ( istream &  is,
const XMLCrystTag tag 
)
virtual

Input in XML format from a stream, restoring the set of refined objects and the associated cost functions.

Note that the corresponding objects must have been loaded in memory before, else shit happens.

Implements ObjCryst::OptimizationObj.

Definition at line 142 of file Simplex.cpp.

void ObjCryst::SimplexObj::XMLOutput ( ostream &  os,
int  indent = 0 
) const
virtual

Output a description of the object in XML format to a stream.

This saves the list of refined object and the cost functions, as well as options for the refinement. The refined objects are not saved, so this must be done somewhere else (they must be reloaded before this object).

Implements ObjCryst::OptimizationObj.

Definition at line 139 of file Simplex.cpp.


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