#include <RefinableObj.h>
Inheritance diagram for ObjCryst::RefinableObj::
Public Methods | |
RefinableObj () | |
Constructor. | |
RefinableObj (const RefinableObj &old) | |
Copy Constructor. | |
virtual | ~RefinableObj () |
Destructor. | |
virtual const string | GetClassName () const |
Name for this class ("RefinableObj", "Crystal",...). This is only useful to distinguish different classes when picking up objects from the RefinableObj Global Registry. | |
virtual const string & | GetName () const |
Name of the object. | |
virtual void | SetName (const string &name) |
Name of the object. | |
void | operator= (const RefinableObj &old) |
Making copies... This does not copy saved RefParSets. | |
void | PrepareForRefinement () const |
Find which parameters are used and not fixed, for a refinement /optimization. This must be called before any refinement... | |
void | FixAllPar () |
Fix All parameters. | |
void | UnFixAllPar () |
UnFix All parameters. | |
void | SetParIsFixed (const long parIndex, const bool fix) |
Fix/un-fix one parameter from its #. | |
void | SetParIsFixed (const string &parName, const bool fix) |
Fix/un-fix one parameter from its name. | |
void | SetParIsFixed (const RefParType *type, const bool fix) |
Fix/un-fix one family of parameters. | |
void | SetParIsUsed (const string &parName, const bool use) |
Set whether a parameter is used. | |
void | SetParIsUsed (const RefParType *type, const bool use) |
Set whether a family of parameters is used. | |
long | GetNbPar () const |
Total number of refinable parameter in the object. Note that some may be actually fixed or even not used !! For refinement use PrepareForRefinement(), NbRefParNotFixed(), and ParNotFixed(i). | |
long | GetNbParNotFixed () const |
Total number of non-fixed parameters. Is initialized by PrepareForRefinement(). | |
RefinablePar & | GetPar (const long i) |
Access all parameters in the order they were inputted. | |
const RefinablePar & | GetPar (const long i) const |
Access all parameters in the order they were inputted. | |
RefinablePar & | GetPar (const string &name) |
Access all parameters from their name. | |
const RefinablePar & | GetPar (const string &name) const |
Access all parameters from their name. | |
RefinablePar & | GetPar (const double *) |
Access parameter from its adress. | |
const RefinablePar & | GetPar (const double *) const |
Access parameter from its adress. | |
RefinablePar & | GetParNotFixed (const long i) |
Access all parameters in the order they were inputted, skipping fixed parameters. Must call PrepareForRefinement() before ! | |
const RefinablePar & | GetParNotFixed (const long i) const |
Access all parameters in the order they were inputed, skipping fixed parameters. Must call PrepareForRefinement() before ! | |
void | AddPar (const RefinablePar &newRefPar) |
void | AddPar (const RefinableObj &newRefParList) |
virtual void | Print () const |
long | CreateParamSet (const string name="") const |
Save the current set of refined values in a new set. More... | |
void | SaveParamSet (const long id) const |
Save the current set of refined values over a previously-created set of saved values. More... | |
void | RestoreParamSet (const long id) |
Restore a saved set of values. More... | |
const CrystVector_double & | GetParamSet (const long setId) const |
Access one save refpar set. More... | |
double | GetParamSet_ParNotFixedHumanValue (const long setId, const long parNumber) const |
Access the (human) value of one refined parameter in a saved set of parameters. More... | |
const void | EraseAllParamSet () |
Erase all saved refpar sets. | |
void | SetLimitsAbsolute (const string &parName, const double min, const double max) |
Change the limits for a given parameter, giving absolute new limits. | |
void | SetLimitsAbsolute (const RefParType *type, const double min, const double max) |
Change the limits for a category of parameters, giving absolute new limits. | |
void | SetLimitsRelative (const string &parName, const double min, const double max) |
Change the limits for a given parameter, giving relative new limits (eg giving -.1 and +.1 will set new limits at the current value + min and current value + max) Thus min should logically be <0 and max >0. | |
void | SetLimitsRelative (const RefParType *type, const double min, const double max) |
Change the limits for a category of parameters, giving relative new limits (eg giving -.1 and +.1 will set new limits at the current value + min and current value + max). Thus min should logically be <0 and max >0. | |
void | SetLimitsProportional (const string &parName, const double min, const double max) |
Change the limits for a given parameter, proportionnaly to the current value. min should be < 1. and max > 1. | |
void | SetLimitsProportional (const RefParType *type, const double min, const double max) |
Change the limits for a category of parameters, proportionnaly to their current value. min should be < 1. and max > 1. | |
ObjRegistry< RefinableObj > & | GetSubObjRegistry () |
Access to the registry of RefinableObj used by this object. | |
const ObjRegistry< RefinableObj > & | GetSubObjRegistry () const |
Access to the registry of RefinableObj used by this object. | |
virtual void | RegisterClient (RefinableObj &) const |
Register a new object using this object. More... | |
virtual void | DeRegisterClient (RefinableObj &) const |
Deregister an object (which not any more) using this object. | |
bool | IsBeingRefined () const |
Is the object being refined ? (Can be refined by one algorithm at a time only.). | |
virtual void | BeginOptimization () |
This should be called by any optimization class at the begining of an optimization. More... | |
virtual void | EndOptimization () |
This should be called by any optimization class at the begining of an optimization. More... | |
virtual void | RandomizeConfiguration () |
Randomize Configuration (before a global optimization). This Affects only parameters which are limited and not fixed. The randomization also affects all sub-objects (recursive). | |
virtual void | GlobalOptRandomMove (const double mutationAmplitude) |
Make a random move of the current configuration. More... | |
virtual unsigned int | GetNbCostFunction () const |
Number of Cost functions. | |
virtual const string & | GetCostFunctionName (const unsigned int) const |
Get a Cost function name from its id#. | |
virtual const string & | GetCostFunctionDescription (const unsigned int) const |
Get the (short) description of a cost function. | |
virtual double | GetCostFunctionValue (const unsigned int) |
Get the current value of a cost function this should be const... | |
void | ResetParList () |
Re-init the list of refinable parameters, removing all parameters. This should never be used... | |
virtual void | XMLOutput (ostream &os, int indent=0) const |
Output to stream in well-formed XML. More... | |
virtual void | XMLInput (istream &is, const XMLCrystTag &tag) |
Input From stream. More... | |
virtual void | UpdateDisplay () const |
If there is an interface, this should be automatically be called each time there is a 'new, significant' configuration to report. | |
unsigned int | GetNbOption () const |
Number of Options for this object. | |
RefObjOpt & | GetOption (const unsigned int i) |
Access to the options. | |
const RefObjOpt & | GetOption (const unsigned int i) const |
const access to the options. | |
Protected Methods | |
long | FindPar (const string &name) const |
Find a refinable parameter with a given name. | |
long | FindPar (const double *) const |
Find a refinable parameter from the adress of its value. | |
void | AddSubRefObj (RefinableObj &) |
Add an object in the registry of used objects. | |
void | RemoveSubRefObj (RefinableObj &) |
Remove an object in the registry of used objects. | |
void | InitRandomSeedFromTime () const |
Init the seed for random number generation from current time. | |
void | AddOption (RefObjOpt *opt) |
Add an option for this parameter. | |
virtual void | Prepare () |
Prepare everything (if necessary) for an optimization/calculation. | |
Protected Attributes | |
string | mName |
Name for this RefinableObject. Should be unique, at least in the same scope.+. | |
RefinablePar ** | mpRefPar |
Array of refinable parameters. | |
long | mNbRefPar |
Number of refinable parameters. | |
long | mMaxNbRefPar |
Maximum number of refinable parameters (array size-dynamically allocated). | |
CrystVector_double ** | mpSavedValuesSet |
Array of pointers to arrays used to save sets of values for all parameters. | |
string ** | mpSavedValuesSetName |
Names associated to the saved values sets. | |
CrystVector_bool | mSavedValuesSetIsUsed |
Is the set associated with (id) currently used ? | |
long | mNbRefParNotFixed |
Total of not-fixed parameters. | |
CrystVector_long | mRefparNotFixedIndex |
Index of not-fixed parameters. | |
bool | mIsbeingRefined |
Is the object being refined ? | |
ObjRegistry< RefinableObj > | mSubObjRegistry |
Registry of RefinableObject needed for this object (owned by this object or not). | |
ObjRegistry< RefinableObj > | mClientObjRegistry |
Registry of RefinableObject using this object. This is mutable so that client can modify it (kludge?). | |
ObjRegistry< RefObjOpt > | mOptionRegistry |
List of options for this object. Note that these are just references, to options allocated by the object, to have a simple global access to all options. | |
Static Protected Attributes | |
const int | mMaxNbSavedSets = 1000 |
Max number of saved sets (memory is dynamically allocated...). |
This is basically a list of refinable parameters, with other basic common properties such as a name,. etc... This allows optimization/refinement algorithms to access the parameters without knowing what the object really is.
|
This should be called by any optimization class at the begining of an optimization. This will also check that everything is ready, eg call the RefinableObj::Prepare() function. This also affects all sub-objects.
|
|
Save the current set of refined values in a new set.
|
|
This should be called by any optimization class at the begining of an optimization. This also affects all sub-objects.
|
|
Access one save refpar set.
|
|
Access the (human) value of one refined parameter in a saved set of parameters.
|
|
Make a random move of the current configuration. This is for global optimization algorithms. the moves for each parameter are less than their global optimization step, multiplied by the mutation amplitude. \warning: this makes a random move for the parameter declared for this object, and it is the duty of the object to decide whether the included objects should be moved and how. (eg an algorithm should only call for a move with the top object, and this object decides how he and his sub-objects moves). By default (RefinableObj implementation) all included objects are moved recursively.
Reimplemented in ObjCryst::Crystal. |
|
Register a new object using this object.
|
|
Restore a saved set of values.
|
|
Save the current set of refined values over a previously-created set of saved values.
|
|
Input From stream.
Reimplemented in ObjCryst::Atom, ObjCryst::Crystal, ObjCryst::DiffractionDataSingleCrystal, ObjCryst::PowderPatternBackground, ObjCryst::PowderPatternDiffraction, ObjCryst::PowderPattern, ObjCryst::Radiation, ObjCryst::ScatteringPowerAtom, and ObjCryst::ZScatterer. |
|
Output to stream in well-formed XML.
Reimplemented in ObjCryst::Atom, ObjCryst::Crystal, ObjCryst::DiffractionDataSingleCrystal, ObjCryst::PowderPatternBackground, ObjCryst::PowderPatternDiffraction, ObjCryst::PowderPattern, ObjCryst::Radiation, ObjCryst::ScatteringPowerAtom, and ObjCryst::ZScatterer. |