COPASI API  4.16.103
CFitMethod.cpp
Go to the documentation of this file.
1 /* Begin CVS Header
2  $Source: /Volumes/Home/Users/shoops/cvs/copasi_dev/copasi/parameterFitting/CFitMethod.cpp,v $
3  $Revision: 1.5 $
4  $Name: $
5  $Author: shoops $
6  $Date: 2006/04/27 01:30:29 $
7  End CVS Header */
8 
9 // Copyright 2005 by Pedro Mendes, Virginia Tech Intellectual
10 // Properties, Inc. and EML Research, gGmbH.
11 // All rights reserved.
12 
13 #include "copasi.h"
14 
15 #include "CFitTask.h"
16 #include "CFitMethod.h"
17 #include "CFitProblem.h"
18 
20 
21 const std::string CFitMethod::TypeName[] =
22  {
23  ""
24  };
25 
27 {
28  COptMethod * pMethod = NULL;
29 
30  /*
31  switch (subType)
32  {
33  case GeneticAlgorithmSR:
34  pMethod = new COptMethodGASR();
35  break;
36 
37  default:
38  */
39  pMethod = COptMethod::createMethod(subType);
40  /*
41  break;
42  }
43  */
44 
45  return pMethod;
46 }
47 
48 // Default constructor
50  COptMethod(CCopasiTask::parameterFitting, CCopasiMethod::unset),
51  mpFitProblem(NULL),
52  mpFitTask(NULL)
54 
56  const CCopasiContainer * pParent):
57  COptMethod(CCopasiTask::parameterFitting, subType, pParent),
58  mpFitProblem(NULL),
59  mpFitTask(NULL)
61 
63  const CCopasiContainer * pParent):
64  COptMethod(src, pParent),
65  mpFitProblem(src.mpFitProblem),
66  mpFitTask(src.mpFitTask)
68 
70 {}
71 
73 {
74  if (!COptMethod::initialize()) return false;
75 
76  mpFitTask = dynamic_cast<CFitTask *>(getObjectParent());
77  if (!mpFitTask) return false;
78 
79  return true;
80 }
81 
83 {
84  if (!COptMethod::isValidProblem(pProblem)) return false;
85 
86  const CFitProblem * pTP = dynamic_cast<const CFitProblem *>(pProblem);
87  if (!pTP)
88  {
89  CCopasiMessage(CCopasiMessage::EXCEPTION, "Problem is not a parameter estimation problem.");
90  return false;
91  }
92 
93  return true;
94 }
virtual bool isValidProblem(const CCopasiProblem *pProblem)
Definition: COptMethod.cpp:219
virtual bool initialize()
Definition: COptMethod.cpp:189
virtual ~CFitMethod()
Definition: CFitMethod.cpp:69
static COptMethod * createMethod(CCopasiMethod::SubType subType=CCopasiMethod::RandomSearch)
Definition: COptMethod.cpp:50
static const std::string TypeName[]
Definition: CFitMethod.h:30
virtual bool isValidProblem(const CCopasiProblem *pProblem)
Definition: CFitMethod.cpp:82
CFitTask * mpFitTask
Definition: CFitMethod.h:84
static COptMethod * createMethod(CCopasiMethod::SubType subType=CCopasiMethod::EvolutionaryProgram)
Definition: CFitMethod.cpp:26
virtual bool initialize()
Definition: CFitMethod.cpp:72
CCopasiContainer * getObjectParent() const
#define CONSTRUCTOR_TRACE
Definition: copasi.h:202