00001 // QuorumSensingRunDirector.cpp: implementation of the CQuorumSensingRunDirector class. 00002 // 00004 00005 #include "QuorumSensingRunDirector.h" 00006 00008 // Construction/Destruction 00010 00011 CQuorumSensingRunDirector::CQuorumSensingRunDirector() 00012 { 00013 int graphnum = -1; 00014 00015 double maxSimTime = 5760.0; 00016 int intTime = (int) maxSimTime + 2; 00017 double stepSize = 0.001; 00018 double frequency = 1.0; 00019 double moveTol = 1.0e-06; 00020 int nChemicals; 00021 00022 // no octopine no OOHL - steady state 00023 m_vpRxnNetworks.push_back(new CQuorumSensingNetwork()); 00024 m_vpRxnMovers.push_back(new CQualityControlCashKarpMover(frequency,stepSize,moveTol)); 00025 nChemicals = m_vpRxnNetworks[0]->GetNumberOfChemicals(); 00026 m_vpCellObservers.push_back(new CellAverageObserver(nChemicals,intTime,1)); 00027 m_vpRunnables.push_back(new CRunnable()); 00028 m_vpRunnables[0]->SetComponents(m_vpRxnNetworks[0],m_vpRxnMovers[0],m_vpCellObservers[0]); 00029 // create an observer for the runnable 00030 m_vpGnuPlotters.push_back(new GnuPlotterRunnableObserver()); 00031 // m_vpGnuPlotters[0]->AddChemicalNumberToList(1); 00032 m_vpGnuPlotters[0]->AddChemicalNumberToList(12); 00033 m_vpGnuPlotters[0]->AddChemicalNumberToList(13); 00034 m_vpGnuPlotters[0]->AddChemicalNumberToList(32); 00035 m_vpGnuPlotters[0]->AddChemicalNumberToList(25); 00036 m_vpGnuPlotters.push_back(new GnuPlotterRunnableObserver()); 00037 m_vpGnuPlotters[1]->AddChemicalNumberToList(1); 00038 // m_vpGnuPlotters[1]->AddChemicalNumberToList(9); 00039 // m_vpGnuPlotters[1]->AddChemicalNumberToList(11); 00040 // m_vpGnuPlotters[1]->AddChemicalNumberToList(12); 00041 // m_vpGnuPlotters[1]->AddChemicalNumberToList(13); 00042 // m_vpGnuPlotters[1]->AddChemicalNumberToList(14); 00043 // m_vpGnuPlotters[1]->AddChemicalNumberToList(27); 00044 // attach the observer 00045 m_vpRunnables[0]->Attach(m_vpGnuPlotters[0]); 00046 m_vpRunnables[0]->Attach(m_vpGnuPlotters[1]); 00047 00048 // octopine and OOHL 00049 m_vpRxnNetworks.push_back(new CQuorumSensingNetwork()); 00050 m_vpRxnMovers.push_back(new CQualityControlCashKarpMover(frequency,stepSize,moveTol)); 00051 nChemicals = m_vpRxnNetworks[1]->GetNumberOfChemicals(); 00052 m_vpCellObservers.push_back(new CellAverageObserver(nChemicals,intTime,1)); 00053 m_vpRunnables.push_back(new CRunnable()); 00054 m_vpRunnables[1]->SetComponents(m_vpRxnNetworks[1],m_vpRxnMovers[1],m_vpCellObservers[0]); 00055 // create an observer for the runnable 00056 m_vpGnuPlotters.push_back(new GnuPlotterRunnableObserver()); 00057 m_vpGnuPlotters[2]->AddChemicalNumberToList(12); 00058 m_vpGnuPlotters[2]->AddChemicalNumberToList(13); 00059 m_vpGnuPlotters[2]->AddChemicalNumberToList(32); 00060 m_vpGnuPlotters[2]->AddChemicalNumberToList(25); 00061 m_vpGnuPlotters.push_back(new GnuPlotterRunnableObserver()); 00062 m_vpGnuPlotters[3]->AddChemicalNumberToList(1); 00063 // m_vpGnuPlotters[3]->AddChemicalNumberToList(9); 00064 // m_vpGnuPlotters[3]->AddChemicalNumberToList(11); 00065 // m_vpGnuPlotters[3]->AddChemicalNumberToList(12); 00066 // m_vpGnuPlotters[3]->AddChemicalNumberToList(13); 00067 // m_vpGnuPlotters[3]->AddChemicalNumberToList(14); 00068 // m_vpGnuPlotters[3]->AddChemicalNumberToList(20); 00069 // m_vpGnuPlotters[3]->AddChemicalNumberToList(27); 00070 // attach the observer 00071 m_vpRunnables[1]->Attach(m_vpGnuPlotters[2]); 00072 m_vpRunnables[1]->Attach(m_vpGnuPlotters[3]); 00073 00074 00075 /* 00076 // m_vpGnuPlotters[0]->AddChemicalNumberToList(0); 00077 // m_vpGnuPlotters[0]->AddChemicalNumberToList(1); 00078 m_vpGnuPlotters[0]->AddChemicalNumberToList(2); 00079 m_vpGnuPlotters[0]->AddChemicalNumberToList(3); 00080 m_vpGnuPlotters[0]->AddChemicalNumberToList(4); 00081 // m_vpGnuPlotters[0]->AddChemicalNumberToList(5); 00082 m_vpGnuPlotters[0]->AddChemicalNumberToList(6); 00083 m_vpGnuPlotters[0]->AddChemicalNumberToList(7); 00084 // attach the observer 00085 m_vpRunnables[0]->Attach(m_vpGnuPlotters[0]); 00086 00087 // create an observer for the runnable 00088 m_vpGnuPlotters.push_back(new GnuPlotterRunnableObserver()); 00089 m_vpGnuPlotters[1]->AddChemicalNumberToList(8); 00090 m_vpGnuPlotters[1]->AddChemicalNumberToList(9); 00091 // m_vpGnuPlotters[1]->AddChemicalNumberToList(10); 00092 m_vpGnuPlotters[1]->AddChemicalNumberToList(11); 00093 m_vpGnuPlotters[1]->AddChemicalNumberToList(12); 00094 m_vpGnuPlotters[1]->AddChemicalNumberToList(13); 00095 m_vpGnuPlotters[1]->AddChemicalNumberToList(14); 00096 m_vpGnuPlotters[1]->AddChemicalNumberToList(15); 00097 // attach the observer 00098 m_vpRunnables[0]->Attach(m_vpGnuPlotters[1]); 00099 00100 // create an observer for the runnable 00101 m_vpGnuPlotters.push_back(new GnuPlotterRunnableObserver()); 00102 m_vpGnuPlotters[2]->AddChemicalNumberToList(16); 00103 // m_vpGnuPlotters[2]->AddChemicalNumberToList(17); 00104 m_vpGnuPlotters[2]->AddChemicalNumberToList(18); 00105 m_vpGnuPlotters[2]->AddChemicalNumberToList(19); 00106 m_vpGnuPlotters[2]->AddChemicalNumberToList(20); 00107 m_vpGnuPlotters[2]->AddChemicalNumberToList(21); 00108 m_vpGnuPlotters[2]->AddChemicalNumberToList(22); 00109 // m_vpGnuPlotters[2]->AddChemicalNumberToList(23); 00110 // attach the observer 00111 m_vpRunnables[0]->Attach(m_vpGnuPlotters[2]); 00112 00113 // create an observer for the runnable 00114 m_vpGnuPlotters.push_back(new GnuPlotterRunnableObserver()); 00115 m_vpGnuPlotters[3]->AddChemicalNumberToList(24); 00116 m_vpGnuPlotters[3]->AddChemicalNumberToList(25); 00117 m_vpGnuPlotters[3]->AddChemicalNumberToList(26); 00118 m_vpGnuPlotters[3]->AddChemicalNumberToList(27); 00119 m_vpGnuPlotters[3]->AddChemicalNumberToList(28); 00120 m_vpGnuPlotters[3]->AddChemicalNumberToList(29); 00121 // m_vpGnuPlotters[3]->AddChemicalNumberToList(30); 00122 m_vpGnuPlotters[3]->AddChemicalNumberToList(31); 00123 // attach the observer 00124 m_vpRunnables[0]->Attach(m_vpGnuPlotters[3]); 00125 00126 // create an observer for the runnable 00127 m_vpGnuPlotters.push_back(new GnuPlotterRunnableObserver()); 00128 m_vpGnuPlotters[4]->AddChemicalNumberToList(32); 00129 m_vpGnuPlotters[4]->AddChemicalNumberToList(33); 00130 m_vpGnuPlotters[4]->AddChemicalNumberToList(34); 00131 m_vpGnuPlotters[4]->AddChemicalNumberToList(35); 00132 m_vpGnuPlotters[4]->AddChemicalNumberToList(36); 00133 m_vpGnuPlotters[4]->AddChemicalNumberToList(37); 00134 m_vpGnuPlotters[4]->AddChemicalNumberToList(38); 00135 // attach the observer 00136 m_vpRunnables[0]->Attach(m_vpGnuPlotters[4]); 00137 */ 00138 // define runs 00139 DefineRuns(); 00140 00141 } 00142 00143 CQuorumSensingRunDirector::~CQuorumSensingRunDirector() 00144 { 00145 00146 } 00147 00148 void CQuorumSensingRunDirector::DefineRuns() 00149 { 00150 // set parameters in the runnables to those read from a previous 00151 // optimization pass; assumes all runnables have same number of 00152 // rate constants 00153 ParameterReader *pReader = new ParameterReader("goodtemp6.par"); 00154 // ParameterReader *pReader = new ParameterReader("optimized.par"); 00155 int nRC = m_vpRunnables[0]->GetReactionNetwork()->GetNumberOfRateConstants(); 00156 for(int j = 0; j < nRC; j++) 00157 { 00158 double rate = pReader->ReadParameter(); 00159 for(int i = 0; i < m_vpRunnables.size(); i++) 00160 { 00161 m_vpRunnables[i]->GetReactionNetwork()->GetRateConstant(j)->SetRateConstant(rate); 00162 } 00163 } 00164 delete pReader; 00165 00166 00167 // specific to this simulation 00168 00169 // no octopine no OOHL 00170 m_vpRunnables[0]->GetReactionNetwork()->ChemicalReset(); 00171 m_vpGnuPlotters[0]->SetTitle("TraA original OOHL"); 00172 m_vpGnuPlotters[1]->SetTitle("TraR forms no octopine no OOHL"); 00173 00174 //octopine and OOHL 00175 // m_vpRunnables[1]->GetReactionNetwork()->GetChemical(1)->SetInitialAmount(1600); 00176 m_vpRunnables[1]->GetReactionNetwork()->GetChemical(0)->SetInitialAmount(5.0e07); 00177 m_vpRunnables[1]->GetReactionNetwork()->ChemicalReset(); 00178 m_vpGnuPlotters[2]->SetTitle("TraA new OOHL"); 00179 m_vpGnuPlotters[3]->SetTitle("TraR forms octopine and OOHL"); 00180 00181 /* m_vpGnuPlotters[1]->SetTitle("no octopine no OOHL 1"); 00182 m_vpGnuPlotters[2]->SetTitle("no octopine no OOHL 2"); 00183 m_vpGnuPlotters[3]->SetTitle("no octopine no OOHL 3"); 00184 m_vpGnuPlotters[4]->SetTitle("no octopine no OOHL 4"); 00185 */ 00186 }