15 for (
const auto& mp : vModelPaths_)
20 auto rest = make_shared<ModelPath> ();
22 for (
const auto& model:models)
24 Vuint v((uint)model->getNumberOfModels());
25 iota(v.begin(), v.end(), 0);
26 rest->setModel(model, v);
31 if (rest->size() != 0)
41 shared_ptr<MixedTransitionModelInterface> m2)
43 for (
auto& mp: vModelPaths_)
45 mp->changeModel(m1, m2);
53 size_t nhn = getNumberOfModelPaths();
54 for (
size_t i = 0; i < nhn; i++)
59 tthn += (*getModelPath(i));
78 size_t nbh = getNumberOfModelPaths();
86 shared_ptr<MixedTransitionModelInterface> pfSM(vModelPaths_[0]->getLeadModel());
89 throw Exception(
"ModelScenario::computeModelPathsProbabilities: missing lead Model.");
91 for (
size_t nh = 0; nh < nbh; nh++)
99 for (
const auto& fn:fnd)
101 fprob += pfSM->getNProbability(
static_cast<size_t>(fn));
107 throw Exception(
"ModelScenario::computeModelPathsProbabilities : reference model " + pfSM->getName() +
" is missing in ModelPath " +
TextTools::toString(nh));
112 auto models = getModels();
114 for (
auto model:getModels())
118 for (
size_t nh = 0; nh < nbh; nh++)
122 throw Exception(
"ModelScenario::computeModelPathsProbabilities : reference model " + model->getName() +
" is missing in ModelPath " +
TextTools::toString(nh));
128 prob += model->getNProbability(
static_cast<size_t>(fn));
134 model->setNProbability(
static_cast<size_t>(fn), h.
getProbability() * model->getNProbability(
static_cast<size_t>(fn)) / prob);
140 model->normalizeVRates();
145 for (
size_t nh = 0; nh < nbh; nh++)
151 model->setNProbability(
static_cast<size_t>(fn),
152 model->getNProbability(
static_cast<size_t>(fn)) / h.
getProbability());
162 for (
const auto& mp :vModelPaths_)
164 output +=
"<" + mp->toString() +
">";
172 vector<shared_ptr<MixedTransitionModelInterface>> models, models2;
174 for (
const auto& mp : vModelPaths_)
176 auto vmodel = mp->getModels();
177 for (
auto& model:vmodel)
179 if (find(models.begin(), models.end(), model) == models.end())
180 models.push_back(model);
181 else if (find(models2.begin(), models2.end(), model) == models2.end())
182 models2.push_back(model);
A vector<int> where all elements are different and in INCREASING ORDER. So inclusion should be done t...
Organization of submodels in mixed substitution models in a path. See class ModelScenario for a thoro...
bool intersects(const ModelPath &) const
checks if this ModelPath intersects another one. Which means that one submodel explicitly declared in...
const PathNode & getPathNode(std::shared_ptr< MixedTransitionModelInterface > mMod) const
gets the pathnode associated with a model
double getProbability() const
returns the probability
void setProbability(double x)
sets the probability
std::vector< std::shared_ptr< MixedTransitionModelInterface > > getModels() const
gets the MixedTransitionModel used in the ModelPath
bool hasModel(std::shared_ptr< MixedTransitionModelInterface > mMod) const
checks if there is a pathnode associated with a model
void computeModelPathsProbabilities()
compute the probabilities in all the ModelPaths
std::vector< std::shared_ptr< MixedTransitionModelInterface > > getModels() const
return models found in several paths
void changeModel(std::shared_ptr< MixedTransitionModelInterface > m1, std::shared_ptr< MixedTransitionModelInterface > m2)
bool hasExclusivePaths() const
Checks if all the path (ie hypernodes) are exclusive.
std::string toString() const
string description
std::string toString(T t)
Defines the basic types of data flow nodes.
std::vector< unsigned int > Vuint