bpp-core3  3.0.0
bpp::AbstractParameterAliasable Class Referenceabstract

A partial implementation of the Parametrizable interface. More...

#include <Bpp/Numeric/AbstractParameterAliasable.h>

+ Inheritance diagram for bpp::AbstractParameterAliasable:
+ Collaboration diagram for bpp::AbstractParameterAliasable:

Public Member Functions

 AbstractParameterAliasable (const std::string &prefix)
 
 AbstractParameterAliasable (const AbstractParameterAliasable &ap)
 
AbstractParameterAliasableoperator= (const AbstractParameterAliasable &ap)
 
virtual ~AbstractParameterAliasable ()
 
void setNamespace (const std::string &prefix)
 Set the namespace for the parameter names. More...
 
bool hasIndependentParameter (const std::string &name) const
 
const ParameterListgetIndependentParameters () const
 Get the minimal list of parameters to set the model. More...
 
size_t getNumberOfIndependentParameters () const
 Get the number of independent parameters. More...
 
void aliasParameters (const std::string &p1, const std::string &p2)
 alias the parameters. More...
 
void unaliasParameters (const std::string &p1, const std::string &p2)
 Detach two parameters previously set as 'aliased'. More...
 
void aliasParameters (std::map< std::string, std::string > &unparsedParams, bool verbose)
 alias the parameters following the links described in a map, and update the object accordingly. Cycles in aliasing are detected and forbidden. More...
 
ParameterList getAliasedParameters (const ParameterList &pl) const
 Return the list of the names of the parameters that are aliased (directly or not) to one of the parameters of the list. More...
 
ParameterList getFromParameters (const ParameterList &pl) const
 Return the list of the names of the parameters from which the parameters of the list are aliased (directly or not). More...
 
virtual std::vector< std::string > getAlias (const std::string &name) const
 
virtual std::map< std::string, std::string > getAliases () const
 
std::string getFrom (const std::string &name) const
 
bool hasParameter (const std::string &name) const override
 Tell if there is a parameter with specified name. More...
 
const ParameterListgetParameters () const override
 Get all parameters available. More...
 
const Parameterparameter (const std::string &name) const override
 Get the parameter with specified name. More...
 
const std::shared_ptr< Parameter > & getParameter (const std::string &name) const
 
double getParameterValue (const std::string &name) const override
 Get the value for parameter of name 'name'. More...
 
void setAllParametersValues (const ParameterList &parameters) override
 Set the parameters values to be equals to those of parameters. More...
 
void setParameterValue (const std::string &name, double value) override
 Set the value of parameter with name name to be equal to value. More...
 
void setParametersValues (const ParameterList &parameters) override
 Update the parameters from parameters. More...
 
bool matchParametersValues (const ParameterList &parameters) override
 Update the parameters from parameters. More...
 
void removeConstraint (const std::string &name) override
 Remove the constraint associated with one parameter, if any. More...
 
void setConstraint (const std::string &name, std::shared_ptr< ConstraintInterface > constraint) override
 Set/Change the constraint associated with one parameter. More...
 
size_t getNumberOfParameters () const override
 Get the number of parameters. More...
 
std::string getNamespace () const override
 
std::string getParameterNameWithoutNamespace (const std::string &name) const override
 Resolves a parameter name according to the current namespace. More...
 
virtual void fireParameterChanged (const ParameterList &parameters)
 Notify the class when one or several parameters have changed. More...
 
virtual Clonableclone () const =0
 Create a copy of this object and send a pointer to it. More...
 

Protected Member Functions

void addParameter_ (Parameter *parameter)
 
void addParameters_ (const ParameterList &parameters)
 
void shareParameter_ (const std::shared_ptr< Parameter > &parameter)
 
void shareParameters_ (const ParameterList &parameters)
 
void includeParameters_ (const ParameterList &parameters)
 
void deleteParameter_ (size_t index)
 
void deleteParameter_ (std::string &name)
 
void deleteParameters_ (const std::vector< std::string > &names)
 
void resetParameters_ ()
 
const std::shared_ptr< Parameter > & getParameter (size_t i) const
 
std::shared_ptr< Parameter > & getParameter (size_t i)
 
ParametergetParameter_ (const std::string &name)
 
ParametergetParameter_ (size_t index)
 
const ParametergetParameter_ (size_t index) const
 
ParametergetParameterWithNamespace_ (const std::string &name)
 
const ParametergetParameterWithNamespace_ (const std::string &name) const
 
ParameterListgetParameters_ () override
 Get all parameters available. More...
 

Private Attributes

ParameterList independentParameters_
 
std::map< std::string, std::shared_ptr< AliasParameterListener > > aliasListenersRegister_
 

Detailed Description

A partial implementation of the Parametrizable interface.

Parameters are stored in a protected ParameterList object.

The abstract fireParameterChanged() method is provided so that the derived class know when a parameter has changed, and can be updated. All methods call the corresponding method in ParameterList and then call the fireParameterChanged() method.

Definition at line 104 of file AbstractParameterAliasable.h.

Constructor & Destructor Documentation

◆ AbstractParameterAliasable() [1/2]

bpp::AbstractParameterAliasable::AbstractParameterAliasable ( const std::string &  prefix)
inline

◆ AbstractParameterAliasable() [2/2]

◆ ~AbstractParameterAliasable()

virtual bpp::AbstractParameterAliasable::~AbstractParameterAliasable ( )
inlinevirtual

Definition at line 128 of file AbstractParameterAliasable.h.

Member Function Documentation

◆ addParameter_()

◆ addParameters_()

◆ aliasParameters() [1/2]

◆ aliasParameters() [2/2]

void AbstractParameterAliasable::aliasParameters ( std::map< std::string, std::string > &  unparsedParams,
bool  verbose 
)
virtual

alias the parameters following the links described in a map, and update the object accordingly. Cycles in aliasing are detected and forbidden.

Parameters
unparsedParamsthe map of the links : <A,B> matches for A->B aliasing.
verboseverbosity

Implements bpp::ParameterAliasable.

Definition at line 120 of file AbstractParameterAliasable.cpp.

References bpp::ParameterList::addParameter(), aliasParameters(), bpp::ParameterList::clone(), bpp::Parameter::clone(), bpp::ApplicationTools::displayResult(), bpp::AbstractParametrizable::getParameters(), bpp::Parameter::getValue(), bpp::ParameterList::hasParameter(), bpp::AbstractParametrizable::matchParametersValues(), bpp::ParameterList::parameter(), bpp::ParameterList::size(), and bpp::TextTools::toString().

◆ clone()

virtual Clonable* bpp::Clonable::clone ( ) const
pure virtualinherited

Create a copy of this object and send a pointer to it.

Returns
A pointer toward the copy object.

Implemented in bpp::TestFunction, bpp::InfinityDerivableSecondOrderWrapper, bpp::InfinityDerivableFirstOrderWrapper, bpp::InfinityFunctionWrapper, bpp::LinearMatrix< Scalar >, bpp::AssociationGraphImplObserver< N, E, GraphImpl >, bpp::AssociationGraphImplObserver< N, E, DAGraphImpl >, bpp::AssociationGraphImplObserver< N, E, TreeGraphImpl >, bpp::StdErr, bpp::FunctionStopCondition, bpp::ColMatrix< Scalar >, bpp::PlaceboTransformedParameter, bpp::StdOut, bpp::GlobalGraph, bpp::ParametersStopCondition, bpp::StlOutputStreamWrapper, bpp::ReparametrizationDerivableSecondOrderWrapper, bpp::IntervalTransformedParameter, bpp::MetaOptimizer, bpp::IntervalConstraint, bpp::BppUnsignedInteger, bpp::StlOutputStream, bpp::SecondOrderDerivable, bpp::LogsumHmmLikelihood, bpp::RescaledHmmLikelihood, bpp::ReparametrizationDerivableFirstOrderWrapper, bpp::BppInteger, bpp::RowMatrix< Scalar >, bpp::RowMatrix< double >, bpp::RowMatrix< Real >, bpp::Parameter, bpp::Simplex, bpp::LowMemoryRescaledHmmLikelihood, bpp::Table< T >, bpp::AbstractNumericalDerivative, bpp::BppDouble, bpp::RTransformedParameter, bpp::NullOutputStream, bpp::ParametrizableCollection< N >, bpp::FirstOrderDerivable, bpp::OptimizerInterface, bpp::AssociationTreeGraphImplObserver< N, E, TreeGraphImpl >, bpp::AssociationDAGraphImplObserver< N, E, DAGraphImpl >, bpp::ThreePointsNumericalDerivative, bpp::DirichletDiscreteDistribution, bpp::SimpleDiscreteDistribution, bpp::DownhillSimplexMethod, bpp::Number< T >, bpp::Number< double >, bpp::Number< int >, bpp::Number< unsigned int >, bpp::FivePointsNumericalDerivative, bpp::ReparametrizationFunctionWrapper, bpp::DataTable, bpp::PrincipalComponentAnalysis, bpp::DualityDiagram, bpp::TruncatedExponentialDiscreteDistribution, bpp::MetaOptimizerInfos, bpp::BrentOneDimension, bpp::NewtonBacktrackOneDimension, bpp::FunctionOperator< F >, bpp::AutoParameter, bpp::GammaDiscreteDistribution, bpp::MixtureOfDiscreteDistributions, bpp::AliasParameterListener, bpp::Range< T >, bpp::PowellMultiDimensions, bpp::InvariantMixedDiscreteDistribution, bpp::TwoPointsNumericalDerivative, bpp::ParameterListener, bpp::OutputStream, bpp::GoldenSectionSearch, bpp::DirectionFunction, bpp::Point2D< T >, bpp::BetaDiscreteDistribution, bpp::ExponentialDiscreteDistribution, bpp::ParameterList, bpp::CorrespondenceAnalysis, bpp::HmmLikelihood, bpp::GaussianDiscreteDistribution, bpp::BfgsMultiDimensions, bpp::NewtonBacktrackOneDimension::NBODStopCondition, bpp::FullHmmTransitionMatrix, bpp::BppNotANumber, bpp::UniformDiscreteDistribution, bpp::ContingencyTableTest, bpp::Font, bpp::ConstantDistribution, bpp::DiscreteDistributionInterface, bpp::MultipleDiscreteDistribution, bpp::DownhillSimplexMethod::DSMStopCondition, bpp::MathOperator, bpp::BrentOneDimension::BODStopCondition, bpp::ConjugateGradientMultiDimensions, bpp::OptimizationStopCondition, bpp::AutoCorrelationTransitionMatrix, bpp::ParameterEvent, bpp::ComputationTree, bpp::GoldenSectionSearch::GSSStopCondition, bpp::PowellMultiDimensions::PMDStopCondition, bpp::ConstraintInterface, bpp::HmmStateAlphabet, bpp::RGBColor, bpp::SimpleMultiDimensions, bpp::SimpleNewtonMultiDimensions, bpp::HmmEmissionProbabilities, bpp::BinaryOperator, bpp::BppVector< T >, bpp::TransformedParameter, bpp::BppString, bpp::ConstantOperator, bpp::NegativeOperator, bpp::HmmTransitionMatrix, bpp::BppNumberI, bpp::BppBoolean, and bpp::NewtonOneDimension.

Referenced by bpp::FirstOrderDerivable::~FirstOrderDerivable(), and bpp::SecondOrderDerivable::~SecondOrderDerivable().

◆ deleteParameter_() [1/2]

void bpp::AbstractParameterAliasable::deleteParameter_ ( size_t  index)
inlineprotectedvirtual

◆ deleteParameter_() [2/2]

void bpp::AbstractParameterAliasable::deleteParameter_ ( std::string &  name)
inlineprotectedvirtual

◆ deleteParameters_()

void bpp::AbstractParameterAliasable::deleteParameters_ ( const std::vector< std::string > &  names)
inlineprotectedvirtual

Reimplemented from bpp::AbstractParametrizable.

Definition at line 252 of file AbstractParameterAliasable.h.

◆ fireParameterChanged()

virtual void bpp::AbstractParametrizable::fireParameterChanged ( const ParameterList parameters)
inlinevirtualinherited

Notify the class when one or several parameters have changed.

Parameters
parametersA ParameterList object with parameters that changed.

Reimplemented in bpp::TestFunction, bpp::OrderedSimplex, bpp::LogsumHmmLikelihood, bpp::RescaledHmmLikelihood, bpp::LowMemoryRescaledHmmLikelihood, bpp::Simplex, bpp::ParametrizableCollection< N >, bpp::ReparametrizationFunctionWrapper, bpp::MixtureOfDiscreteDistributions, bpp::SimpleDiscreteDistribution, bpp::DirichletDiscreteDistribution, bpp::FullHmmTransitionMatrix, bpp::TruncatedExponentialDiscreteDistribution, bpp::AutoCorrelationTransitionMatrix, bpp::GammaDiscreteDistribution, bpp::InvariantMixedDiscreteDistribution, bpp::BetaDiscreteDistribution, bpp::ExponentialDiscreteDistribution, bpp::GaussianDiscreteDistribution, bpp::UniformDiscreteDistribution, and bpp::ConstantDistribution.

Definition at line 108 of file AbstractParametrizable.h.

Referenced by bpp::ConstantDistribution::fireParameterChanged(), bpp::GaussianDiscreteDistribution::fireParameterChanged(), bpp::BetaDiscreteDistribution::fireParameterChanged(), bpp::ExponentialDiscreteDistribution::fireParameterChanged(), bpp::InvariantMixedDiscreteDistribution::fireParameterChanged(), bpp::GammaDiscreteDistribution::fireParameterChanged(), bpp::TruncatedExponentialDiscreteDistribution::fireParameterChanged(), bpp::DirichletDiscreteDistribution::fireParameterChanged(), bpp::SimpleDiscreteDistribution::fireParameterChanged(), bpp::MixtureOfDiscreteDistributions::fireParameterChanged(), bpp::AbstractParametrizable::matchParametersValues(), bpp::AbstractParametrizable::setAllParametersValues(), bpp::AbstractParametrizable::setParametersValues(), and bpp::AbstractParametrizable::setParameterValue().

◆ getAlias()

vector< string > AbstractParameterAliasable::getAlias ( const std::string &  name) const
virtual
Returns
The list of names of the parameters that are aliased with a given parameter. The implementation is recursive, which means that in the case of A->B->C, getalias(C) will return both A and B.
Parameters
nameThe name of the parameter to look for.

Implements bpp::ParameterAliasable.

Definition at line 204 of file AbstractParameterAliasable.cpp.

References aliasListenersRegister_, and bpp::VectorTools::append().

Referenced by getAliases(), and bpp::ParametrizableCollection< N >::removeObject().

◆ getAliasedParameters()

ParameterList AbstractParameterAliasable::getAliasedParameters ( const ParameterList pl) const

Return the list of the names of the parameters that are aliased (directly or not) to one of the parameters of the list.

Definition at line 244 of file AbstractParameterAliasable.cpp.

References bpp::ParameterList::addParameter(), aliasListenersRegister_, bpp::ParameterList::hasParameter(), and bpp::AbstractParametrizable::parameter().

◆ getAliases()

std::map< std::string, std::string > AbstractParameterAliasable::getAliases ( ) const
virtual
Returns
the map of the aliases.

Implements bpp::ParameterAliasable.

Definition at line 225 of file AbstractParameterAliasable.cpp.

References aliasListenersRegister_, and getAlias().

◆ getFrom()

string AbstractParameterAliasable::getFrom ( const std::string &  name) const
Returns
The name of the parameter from which a given parameter is aliased.
Parameters
nameThe name of the parameter to look for.

Definition at line 280 of file AbstractParameterAliasable.cpp.

References aliasListenersRegister_.

◆ getFromParameters()

ParameterList AbstractParameterAliasable::getFromParameters ( const ParameterList pl) const

Return the list of the names of the parameters from which the parameters of the list are aliased (directly or not).

Definition at line 297 of file AbstractParameterAliasable.cpp.

References bpp::ParameterList::addParameter(), aliasListenersRegister_, bpp::ParameterList::hasParameter(), and bpp::AbstractParametrizable::parameter().

◆ getIndependentParameters()

const ParameterList& bpp::AbstractParameterAliasable::getIndependentParameters ( ) const
inlinevirtual

Get the minimal list of parameters to set the model.

If no parameters are aliased, this is the same a getParameters().

Returns
A minimal set of parameters.

Implements bpp::ParameterAliasable.

Definition at line 135 of file AbstractParameterAliasable.h.

◆ getNamespace()

std::string bpp::AbstractParametrizable::getNamespace ( ) const
inlineoverridevirtualinherited
Returns
The current namespace used. This is an empty string if no namespace is currently defined.

Implements bpp::Parametrizable.

Definition at line 99 of file AbstractParametrizable.h.

References bpp::AbstractParametrizable::getParameterNameWithoutNamespace(), and bpp::AbstractParametrizable::prefix_.

Referenced by aliasParameters(), bpp::MixtureOfDiscreteDistributions::MixtureOfDiscreteDistributions(), bpp::Simplex::setFrequencies(), and setNamespace().

◆ getNumberOfIndependentParameters()

size_t bpp::AbstractParameterAliasable::getNumberOfIndependentParameters ( ) const
inlinevirtual

Get the number of independent parameters.

Returns
The number of independent parameters. If no parameters are aliased, this is equivalent to the getNumberOfParameters() method.

Implements bpp::ParameterAliasable.

Definition at line 137 of file AbstractParameterAliasable.h.

References bpp::AliasParameterListener::getAlias(), bpp::AliasParameterListener::getFrom(), and bpp::ParameterList::size().

◆ getNumberOfParameters()

size_t bpp::AbstractParametrizable::getNumberOfParameters ( ) const
inlineoverridevirtualinherited

◆ getParameter() [1/3]

const std::shared_ptr<Parameter>& bpp::AbstractParametrizable::getParameter ( const std::string &  name) const
inlineinherited

◆ getParameter() [2/3]

const std::shared_ptr<Parameter>& bpp::AbstractParametrizable::getParameter ( size_t  i) const
inlineprotectedinherited
Returns
The shared_ptr parameter at a given position.
Warning
No check is performed on the validity of the index given as input!

Definition at line 211 of file AbstractParametrizable.h.

References bpp::ParameterList::getParameter().

◆ getParameter() [3/3]

std::shared_ptr<Parameter>& bpp::AbstractParametrizable::getParameter ( size_t  i)
inlineprotectedinherited

Definition at line 216 of file AbstractParametrizable.h.

References bpp::ParameterList::getParameter().

◆ getParameter_() [1/3]

◆ getParameter_() [2/3]

Parameter& bpp::AbstractParametrizable::getParameter_ ( size_t  index)
inlineprotectedinherited

Definition at line 190 of file AbstractParametrizable.h.

References bpp::ParameterList::size().

◆ getParameter_() [3/3]

const Parameter& bpp::AbstractParametrizable::getParameter_ ( size_t  index) const
inlineprotectedinherited

Definition at line 197 of file AbstractParametrizable.h.

References bpp::ParameterList::size().

◆ getParameterNameWithoutNamespace()

std::string AbstractParametrizable::getParameterNameWithoutNamespace ( const std::string &  name) const
overridevirtualinherited

Resolves a parameter name according to the current namespace.

Returns
The parameter name without the namespace prefix, if any.

Implements bpp::Parametrizable.

Definition at line 28 of file AbstractParametrizable.cpp.

References bpp::TextTools::startsWith().

Referenced by AbstractParameterAliasable(), bpp::AbstractParametrizable::getNamespace(), and operator=().

◆ getParameters()

const ParameterList& bpp::AbstractParametrizable::getParameters ( ) const
inlineoverridevirtualinherited

◆ getParameters_()

ParameterList& bpp::AbstractParametrizable::getParameters_ ( )
inlineoverrideprotectedvirtualinherited

Get all parameters available.

See also
getIndependentParameters if some parameters are aliased.
Returns
A list with all parameters available.

Implements bpp::Parametrizable.

Definition at line 205 of file AbstractParametrizable.h.

References bpp::AbstractParametrizable::parameters_.

Referenced by AbstractParameterAliasable(), aliasParameters(), and operator=().

◆ getParameterValue()

◆ getParameterWithNamespace_() [1/2]

Parameter& bpp::AbstractParametrizable::getParameterWithNamespace_ ( const std::string &  name)
inlineprotectedinherited
Parameters
nameThe name of the parameter, including its namespace.
Returns
A reference toward the corresponding parameter.
Exceptions
ParameterNotFoundExceptionIf no parameter with that name is found in the list.

Definition at line 176 of file AbstractParametrizable.h.

References bpp::AbstractParametrizable::getParameter_().

◆ getParameterWithNamespace_() [2/2]

const Parameter& bpp::AbstractParametrizable::getParameterWithNamespace_ ( const std::string &  name) const
inlineprotectedinherited
Parameters
nameThe name of the parameter, including its namespace.
Returns
A reference toward the corresponding parameter.
Exceptions
ParameterNotFoundExceptionIf no parameter with that name is found in the list.

Definition at line 185 of file AbstractParametrizable.h.

References bpp::AbstractParametrizable::parameter().

◆ hasIndependentParameter()

bool bpp::AbstractParameterAliasable::hasIndependentParameter ( const std::string &  name) const
inline

Definition at line 133 of file AbstractParameterAliasable.h.

References bpp::ParameterList::hasParameter().

◆ hasParameter()

bool bpp::AbstractParametrizable::hasParameter ( const std::string &  name) const
inlineoverridevirtualinherited

Tell if there is a parameter with specified name.

Parameters
nameThe name of the parameter to look for.
Returns
y/n.

Implements bpp::Parametrizable.

Definition at line 39 of file AbstractParametrizable.h.

References bpp::ParameterList::hasParameter().

Referenced by aliasParameters(), bpp::GammaDiscreteDistribution::fireParameterChanged(), bpp::AbstractParametrizable::getParameter_(), and unaliasParameters().

◆ includeParameters_()

void bpp::AbstractParameterAliasable::includeParameters_ ( const ParameterList parameters)
inlineprotectedvirtual

◆ matchParametersValues()

bool bpp::AbstractParametrizable::matchParametersValues ( const ParameterList parameters)
inlineoverridevirtualinherited

Update the parameters from parameters.

Only common parameters with parameters will be updated.

Parameters
parametersA list of parameters.
Returns
True if at least one parameter value has been changed.
Exceptions
ConstraintExceptionIf a value in parameters does not match the constraint in the corresponding parameter in the list.

Implements bpp::Parametrizable.

Definition at line 76 of file AbstractParametrizable.h.

References bpp::AbstractParametrizable::fireParameterChanged(), bpp::ParameterList::matchParametersValues(), and bpp::ParameterList::shareSubList().

Referenced by aliasParameters(), bpp::Simplex::setFrequencies(), bpp::ReparametrizationFunctionWrapper::setParameters(), and bpp::FullHmmTransitionMatrix::setTransitionProbabilities().

◆ operator=()

◆ parameter()

const Parameter& bpp::AbstractParametrizable::parameter ( const std::string &  name) const
inlineoverridevirtualinherited

Get the parameter with specified name.

Parameters
nameThe name of the parameter to look for.
Returns
The parameter with given name.
Exceptions
ParameterNotFoundExceptionif no parameter with this name is found.

Implements bpp::Parametrizable.

Definition at line 43 of file AbstractParametrizable.h.

References bpp::ParameterList::parameter().

Referenced by getAliasedParameters(), bpp::ReparametrizationDerivableFirstOrderWrapper::getFirstOrderDerivative(), getFromParameters(), bpp::AbstractParametrizable::getParameterValue(), bpp::AbstractParametrizable::getParameterWithNamespace_(), and bpp::ReparametrizationDerivableSecondOrderWrapper::getSecondOrderDerivative().

◆ removeConstraint()

void bpp::AbstractParametrizable::removeConstraint ( const std::string &  name)
inlineoverridevirtualinherited

Remove the constraint associated with one parameter, if any.

Parameters
nameThe name of the parameter to look for.
Exceptions
ParameterNotFoundExceptionif no parameter with this name is found.

Implements bpp::Parametrizable.

Definition at line 85 of file AbstractParametrizable.h.

References bpp::AbstractParametrizable::getParameter_(), and bpp::Parameter::removeConstraint().

◆ resetParameters_()

void bpp::AbstractParameterAliasable::resetParameters_ ( )
inlineprotected

◆ setAllParametersValues()

void bpp::AbstractParametrizable::setAllParametersValues ( const ParameterList parameters)
inlineoverridevirtualinherited

Set the parameters values to be equals to those of parameters.

The list must contain exactly the same parameters (ie same names) than the parameters available.

Parameters
parametersA list with all parameters.
Exceptions
ParameterNotFoundExceptionIf a some parameter in the list is not in params.
ConstraintExceptionIf a value in parameters does not match the constraint in the corresponding parameter in the list.

Implements bpp::Parametrizable.

Definition at line 58 of file AbstractParametrizable.h.

References bpp::AbstractParametrizable::fireParameterChanged(), and bpp::ParameterList::setAllParametersValues().

◆ setConstraint()

void bpp::AbstractParametrizable::setConstraint ( const std::string &  name,
std::shared_ptr< ConstraintInterface constraint 
)
inlineoverridevirtualinherited

Set/Change the constraint associated with one parameter.

Parameters
nameThe name of the parameter to look for.
constraintA pointer to the constraint (may be null)
Exceptions
ParameterNotFoundExceptionif no parameter with this name is found.

Implements bpp::Parametrizable.

Definition at line 90 of file AbstractParametrizable.h.

References bpp::AbstractParametrizable::getParameter_(), and bpp::Parameter::setConstraint().

Referenced by bpp::SimpleDiscreteDistribution::restrictToConstraint().

◆ setNamespace()

void AbstractParameterAliasable::setNamespace ( const std::string &  prefix)
virtual

Set the namespace for the parameter names.

Parameters
prefixThe 'namespace', that is a prefix to add to all parameter names. If parameter names are already prefixed, the new prefix will be used instead.

Implements bpp::Parametrizable.

Reimplemented in bpp::MixtureOfDiscreteDistributions, and bpp::InvariantMixedDiscreteDistribution.

Definition at line 186 of file AbstractParameterAliasable.cpp.

References aliasListenersRegister_, bpp::AbstractParametrizable::getNamespace(), bpp::AbstractParametrizable::setNamespace(), and bpp::TextTools::startsWith().

Referenced by bpp::InvariantMixedDiscreteDistribution::setNamespace(), and bpp::MixtureOfDiscreteDistributions::setNamespace().

◆ setParametersValues()

void bpp::AbstractParametrizable::setParametersValues ( const ParameterList parameters)
inlineoverridevirtualinherited

Update the parameters from parameters.

parameters must be a subset of all parameters available.

Parameters
parametersA list containing all parameters to update.
Exceptions
ParameterNotFoundExceptionIf a some parameter in params is not in the list.
ConstraintExceptionIf a value in parameters does not match the constraint in the corresponding parameter in the list.

Implements bpp::Parametrizable.

Definition at line 70 of file AbstractParametrizable.h.

References bpp::AbstractParametrizable::fireParameterChanged(), and bpp::ParameterList::setParametersValues().

Referenced by bpp::LowMemoryRescaledHmmLikelihood::setParameters(), bpp::LogsumHmmLikelihood::setParameters(), and bpp::RescaledHmmLikelihood::setParameters().

◆ setParameterValue()

void bpp::AbstractParametrizable::setParameterValue ( const std::string &  name,
double  value 
)
inlineoverridevirtualinherited

Set the value of parameter with name name to be equal to value.

Parameters
namethe name of the parameter to set.
valueThe value of the parameter.
Exceptions
ParameterNotFoundExceptionIf no parameter in the list has the name name.
ConstraintExceptionIf value does not match the constraint associated to parameter name.

Implements bpp::Parametrizable.

Definition at line 64 of file AbstractParametrizable.h.

References bpp::ParameterList::createSubList(), bpp::AbstractParametrizable::fireParameterChanged(), and bpp::ParameterList::setParameterValue().

◆ shareParameter_()

void bpp::AbstractParameterAliasable::shareParameter_ ( const std::shared_ptr< Parameter > &  parameter)
inlineprotectedvirtual

◆ shareParameters_()

void bpp::AbstractParameterAliasable::shareParameters_ ( const ParameterList parameters)
inlineprotectedvirtual

◆ unaliasParameters()

void AbstractParameterAliasable::unaliasParameters ( const std::string &  p1,
const std::string &  p2 
)
virtual

Detach two parameters previously set as 'aliased'.

The values of the two parameters will now be independent.

Parameters
p1Original parameter.
p2Aliased parameter.
Exceptions
ParameterNotFoundExceptionif p1 or p2 do not correspond to existing parameters.
Exceptionwhen trying to perform non-valid dissociation.

Implements bpp::ParameterAliasable.

Definition at line 168 of file AbstractParameterAliasable.cpp.

References aliasListenersRegister_, bpp::AbstractParametrizable::getParameter(), bpp::AbstractParametrizable::getParameter_(), bpp::AbstractParametrizable::hasParameter(), independentParameters_, bpp::Parameter::removeParameterListener(), and bpp::ParameterList::shareParameter().

Referenced by bpp::ParametrizableCollection< N >::removeObject().

Member Data Documentation

◆ aliasListenersRegister_

std::map<std::string, std::shared_ptr<AliasParameterListener> > bpp::AbstractParameterAliasable::aliasListenersRegister_
private

Contains all parameter listeners for maintening alias relationships. The registry will be updated appropriately upon cloning and deleting.

Definition at line 115 of file AbstractParameterAliasable.h.

Referenced by AbstractParameterAliasable(), aliasParameters(), getAlias(), getAliasedParameters(), getAliases(), getFrom(), getFromParameters(), operator=(), setNamespace(), and unaliasParameters().

◆ independentParameters_

ParameterList bpp::AbstractParameterAliasable::independentParameters_
mutableprivate

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