00001 // CombinatorialRunDirector.cpp: implementation of the CCombinatorialRunDirector class. 00002 // 00004 00005 #include "CombinatorialRunDirector.h" 00006 00008 // Construction/Destruction 00010 00011 CCombinatorialRunDirector::CCombinatorialRunDirector() 00012 { 00013 double maxSimTime = 720.0; 00014 int intTime = (int) maxSimTime + 2; 00015 double stepSize = 0.001; 00016 double frequency = 0.1; 00017 double moveTol = 1.0e-06; 00018 int seed = 298989; 00019 00020 m_vpRxnNetworks.push_back(new CCombinatorialNetwork()); 00021 // m_vpRxnNetworks[0]->DumpTeXForm("CombinatorialEquations.tex"); 00022 m_vpRxnMovers.push_back(new CQualityControlCashKarpMover(frequency,stepSize,moveTol)); 00023 // m_vpRxnMovers.push_back(new CQualityControlRK2TMover(frequency,stepSize,moveTol)); 00024 // m_vpRxnMovers.push_back(new CContinuousTimeMonteCarloMover(seed,frequency)); 00025 int 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 00030 // create an observer for the runnable 00031 m_vpGnuPlotters.push_back(new GnuPlotterRunnableObserver()); 00032 m_vpGnuPlotters[0]->AddChemicalNumberToList(0); 00033 m_vpGnuPlotters[0]->AddChemicalNumberToList(1); 00034 m_vpGnuPlotters[0]->AddChemicalNumberToList(2); 00035 m_vpGnuPlotters[0]->AddChemicalNumberToList(3); 00036 m_vpGnuPlotters[0]->AddChemicalNumberToList(4); 00037 m_vpGnuPlotters[0]->AddChemicalNumberToList(5); 00038 00039 m_vpGnuPlotters.push_back(new GnuPlotterRunnableObserver()); 00040 m_vpGnuPlotters[1]->AddChemicalNumberToList(6); 00041 m_vpGnuPlotters[1]->AddChemicalNumberToList(7); 00042 m_vpGnuPlotters[1]->AddChemicalNumberToList(8); 00043 m_vpGnuPlotters[1]->AddChemicalNumberToList(9); 00044 m_vpGnuPlotters[1]->AddChemicalNumberToList(10); 00045 00046 m_vpGnuPlotters.push_back(new GnuPlotterRunnableObserver()); 00047 m_vpGnuPlotters[2]->AddChemicalNumberToList(11); 00048 m_vpGnuPlotters[2]->AddChemicalNumberToList(12); 00049 m_vpGnuPlotters[2]->AddChemicalNumberToList(13); 00050 m_vpGnuPlotters[2]->AddChemicalNumberToList(14); 00051 m_vpGnuPlotters[2]->AddChemicalNumberToList(15); 00052 00053 // attach the observer 00054 m_vpRunnables[0]->Attach(m_vpGnuPlotters[0]); 00055 m_vpRunnables[0]->Attach(m_vpGnuPlotters[1]); 00056 m_vpRunnables[0]->Attach(m_vpGnuPlotters[2]); 00057 00058 // define runs 00059 DefineRuns(); 00060 00061 } 00062 00063 CCombinatorialRunDirector::~CCombinatorialRunDirector() 00064 { 00065 00066 } 00067 00068 void CCombinatorialRunDirector::DefineRuns() 00069 { 00070 // set parameters in the runnables to those read from a previous 00071 // optimization pass; assumes all runnables have same number of 00072 // rate constants 00073 00074 ParameterReader *pReader = new ParameterReader("CombinatorialInput.par"); 00075 int nRC = m_vpRunnables[0]->GetReactionNetwork()->GetNumberOfRateConstants(); 00076 for(int j = 0; j < nRC; j++) 00077 { 00078 double rate = pReader->ReadParameter(); 00079 for(int i = 0; i < m_vpRunnables.size(); i++) 00080 { 00081 m_vpRunnables[i]->GetReactionNetwork()->GetRateConstant(j)->SetRateConstant(rate); 00082 } 00083 } 00084 delete pReader; 00085 00086 00087 // specific to this simulation 00088 // Strain D016 00089 m_vpRunnables[0]->GetReactionNetwork()->GetChemical(0)->SetInitialAmount(1.0); 00090 m_vpRunnables[0]->GetReactionNetwork()->GetChemical(1)->SetInitialAmount(1.0); 00091 m_vpRunnables[0]->GetReactionNetwork()->RemoveReaction(44); 00092 m_vpRunnables[0]->GetReactionNetwork()->RemoveReaction(43); 00093 m_vpRunnables[0]->GetReactionNetwork()->RemoveReaction(42); 00094 m_vpRunnables[0]->GetReactionNetwork()->RemoveReaction(41); 00095 m_vpRunnables[0]->GetReactionNetwork()->RemoveReaction(40); 00096 m_vpRunnables[0]->GetReactionNetwork()->RemoveReaction(39); 00097 m_vpRunnables[0]->GetReactionNetwork()->RemoveReaction(38); 00098 m_vpRunnables[0]->GetReactionNetwork()->RemoveReaction(37); 00099 m_vpRunnables[0]->GetReactionNetwork()->RemoveReaction(36); 00100 m_vpRunnables[0]->GetReactionNetwork()->RemoveReaction(35); 00101 m_vpRunnables[0]->GetReactionNetwork()->RemoveReaction(34); 00102 m_vpRunnables[0]->GetReactionNetwork()->RemoveReaction(33); 00103 m_vpRunnables[0]->GetReactionNetwork()->RemoveReaction(30); 00104 m_vpRunnables[0]->GetReactionNetwork()->RemoveReaction(29); 00105 m_vpRunnables[0]->GetReactionNetwork()->RemoveReaction(28); 00106 m_vpRunnables[0]->GetReactionNetwork()->RemoveReaction(27); 00107 m_vpRunnables[0]->GetReactionNetwork()->RemoveReaction(26); 00108 m_vpRunnables[0]->GetReactionNetwork()->RemoveReaction(25); 00109 m_vpRunnables[0]->GetReactionNetwork()->RemoveReaction(22); 00110 m_vpRunnables[0]->GetReactionNetwork()->RemoveReaction(21); 00111 m_vpRunnables[0]->GetReactionNetwork()->RemoveReaction(20); 00112 m_vpRunnables[0]->GetReactionNetwork()->RemoveReaction(19); 00113 m_vpRunnables[0]->GetReactionNetwork()->RemoveReaction(18); 00114 m_vpRunnables[0]->GetReactionNetwork()->RemoveReaction(17); 00115 m_vpRunnables[0]->GetReactionNetwork()->RemoveReaction(16); 00116 m_vpRunnables[0]->GetReactionNetwork()->RemoveReaction(14); 00117 m_vpRunnables[0]->GetReactionNetwork()->RemoveReaction(12); 00118 00119 m_vpRunnables[0]->GetReactionNetwork()->ChemicalReset(); 00120 m_vpGnuPlotters[0]->SetTitle("CombinatorialNetwork"); 00121 00122 00123 }