00001
00002
00004
00005 #include "OneGeneInhibitoryNetworkMinimizableDirector.h"
00006 #include "SharedBFactorNetworkMinimizable.h"
00007 #include "GnuPlotterTimeSeriesSharedBFactorObserver.h"
00008
00010
00012
00013 COneGeneInhibitoryNetworkMinimizableDirector::COneGeneInhibitoryNetworkMinimizableDirector()
00014 {
00015 double maxSimTime = 91.0;
00016 double stepSize = 0.0001;
00017 double frequency = 1.0;
00018 int nCells = 1;
00019 double moveTol = 1.0e-06;
00020
00021 bool rateFlag = true;
00022 bool chemFlag = false;
00023 bool logsFlag = false;
00024 double timeWeight = 1.0;
00025 double rateWeight = 0.0;
00026 double chemWeight = 0.0;
00027
00028 m_dGammaSquared = 1.0e-07;
00029
00030 const char* foundFileName;
00031
00032
00033 _networkList.push_back(new OneGeneInhibitoryNetwork());
00034 _experimentList.push_back(new Experiment(_networkList[0],"SmallNetwork"));
00035
00036 LocateInputFileDirectory locate1("smallOneGeneDS1.dat");
00037 foundFileName = locate1.Get("smallOneGeneDS1.dat");
00038 _experimentList[0]->AddDataFileToList(foundFileName);
00039
00040 _moverList.push_back(new CQualityControlCashKarpMover(frequency,stepSize,moveTol));
00041
00042
00043 _networkList.push_back(new OneGeneInhibitoryNetwork());
00044 _experimentList.push_back(new Experiment(_networkList[1],"SmallNetwork"));
00045
00046 LocateInputFileDirectory locate2("smallOneGeneDS2.dat");
00047 foundFileName = locate2.Get("smallOneGeneDS2.dat");
00048 _experimentList[1]->AddDataFileToList(foundFileName);
00049
00050 _moverList.push_back(new CQualityControlCashKarpMover(frequency,stepSize,moveTol));
00051
00052
00053 _minimizableList.push_back(new SharedBFactorNetworkMinimizable());
00054
00055 _minimizableList[0]->Initialize(_experimentList,_moverList,nCells,rateFlag,chemFlag,logsFlag,timeWeight,rateWeight,chemWeight);
00056 _minimizableList[0]->SetRateConstantsWeight(0.0);
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067 m_iPriorList.push_back(0);
00068 m_iPriorList.push_back(1);
00069 m_iPriorList.push_back(2);
00070 m_iPriorList.push_back(3);
00071 m_iPriorList.push_back(4);
00072 m_iPriorList.push_back(5);
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105 int masterResidualsSize = 0;
00106 for(int i = 0; i < _minimizableList.size(); i++)
00107 {
00108 int subRes = _minimizableList[i]->GetNResiduals();
00109 masterResidualsSize += subRes;
00110 cout << subRes << " residuals in minimizable " << i << endl;
00111 }
00112
00113 masterResidualsSize += m_iPriorList.size();
00114 cout << m_iPriorList.size() << " parameters are constrained by a prior " << endl;
00115 if(m_dGammaSquared > 0.0)
00116 {
00117 masterResidualsSize += 1;
00118 }
00119 Allocate(masterResidualsSize);
00120
00121 cout << "Master Residuals size : " << masterResidualsSize << endl;
00122
00123
00124 DefineExperiments();
00125
00126
00127
00128 }
00129
00130 COneGeneInhibitoryNetworkMinimizableDirector::~COneGeneInhibitoryNetworkMinimizableDirector()
00131 {
00132 for(int i = 0; i < m_vpPlotterList.size(); i++)
00133 {
00134 _minimizableList[i]->Detach(m_vpPlotterList[i]);
00135 delete m_vpPlotterList[i];
00136 }
00137 }
00138
00139 void COneGeneInhibitoryNetworkMinimizableDirector::DefineExperiments()
00140 {
00141
00142 _minimizableList[0]->GetExperiment(0)->GetReactionNetwork()->GetChemical(0)->SetInitialAmount(1.0);
00143 _minimizableList[0]->GetExperiment(0)->GetReactionNetwork()->GetChemical(0)->Reset();
00144 _minimizableList[0]->GetExperiment(0)->GetReactionNetwork()->GetChemical(1)->SetInitialAmount(0.0);
00145 _minimizableList[0]->GetExperiment(0)->GetReactionNetwork()->GetChemical(1)->Reset();
00146
00147
00148 _minimizableList[0]->GetExperiment(1)->GetReactionNetwork()->GetChemical(0)->SetInitialAmount(1.0);
00149 _minimizableList[0]->GetExperiment(1)->GetReactionNetwork()->GetChemical(0)->Reset();
00150 _minimizableList[0]->GetExperiment(1)->GetReactionNetwork()->GetChemical(1)->SetInitialAmount(0.0);
00151 _minimizableList[0]->GetExperiment(1)->GetReactionNetwork()->GetChemical(1)->Reset();
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161 }
00162
00163 double COneGeneInhibitoryNetworkMinimizableDirector::GetParameter(int parIndex)
00164 {
00165
00166 return _minimizableList[0]->GetParameter(parIndex);
00167 }
00168
00169 int COneGeneInhibitoryNetworkMinimizableDirector::GetNParameters()
00170 {
00171
00172 return _minimizableList[0]->GetNParameters();
00173 }
00174