MTAnisoGAConf.cpp

Go to the documentation of this file.
00001 #include <fstream>
00002 #include <algorithm>
00003  #include <CFatalException.h>
00004 #include "MTAnisoGAConf.h"
00005 using namespace std;
00006 void MTAnisoGAConf::GetData(string filename)
00007 {
00008 ifstream infile;
00009 infile.open(filename.c_str());
00010 infile.peek();
00011 if (!infile)
00012   throw CFatalException("No Configurationfile found !");
00013  GetData(infile);infile.close();
00014 }
00015 
00016 void MTAnisoGAConf::GetData(std::ifstream &instream)
00017 {
00018 MTAnisoGAConfLexer lexer(instream);
00019 MTAnisoGAConfParser parser(lexer);
00020 parser.configfile();
00021 verbose= parser.verbose;
00022 mtfitexponent= parser.mtfitexponent;
00023 popsize= parser.popsize;
00024 inittemp= parser.inittemp;
00025 coolingratio= parser.coolingratio;
00026 generations= parser.generations;
00027 mutationprob= parser.mutationprob;
00028 crossoverprob= parser.crossoverprob;
00029 threads= parser.threads;
00030 starttime= parser.starttime;
00031 endtime= parser.endtime;
00032 tensorerror= parser.tensorerror;
00033 reserror= parser.reserror;
00034 phaseerror= parser.phaseerror;
00035 gatype= parser.gatype;
00036 outputbase= parser.outputbase;
00037 mode= parser.mode;
00038 mtfit= parser.mtfit;
00039 mtinputdata= parser.mtinputdata;
00040 ptensordata= parser.ptensordata;
00041 annealinggeneration= parser.annealinggeneration;
00042 elitist= parser.elitist;
00043 thickbase.assign(parser.thickbase.size(),0);
00044 copy(parser.thickbase.begin(),parser.thickbase.end(),thickbase.begin());
00045 thickstep.assign(parser.thickstep.size(),0);
00046 copy(parser.thickstep.begin(),parser.thickstep.end(),thickstep.begin());
00047 thicksizes.assign(parser.thicksizes.size(),0);
00048 copy(parser.thicksizes.begin(),parser.thicksizes.end(),thicksizes.begin());
00049 resbase.assign(parser.resbase.size(),0);
00050 copy(parser.resbase.begin(),parser.resbase.end(),resbase.begin());
00051 resstep.assign(parser.resstep.size(),0);
00052 copy(parser.resstep.begin(),parser.resstep.end(),resstep.begin());
00053 ressizes.assign(parser.ressizes.size(),0);
00054 copy(parser.ressizes.begin(),parser.ressizes.end(),ressizes.begin());
00055 anisobase.assign(parser.anisobase.size(),0);
00056 copy(parser.anisobase.begin(),parser.anisobase.end(),anisobase.begin());
00057 anisostep.assign(parser.anisostep.size(),0);
00058 copy(parser.anisostep.begin(),parser.anisostep.end(),anisostep.begin());
00059 anisosizes.assign(parser.anisosizes.size(),0);
00060 copy(parser.anisosizes.begin(),parser.anisosizes.end(),anisosizes.begin());
00061 strikebase.assign(parser.strikebase.size(),0);
00062 copy(parser.strikebase.begin(),parser.strikebase.end(),strikebase.begin());
00063 strikestep.assign(parser.strikestep.size(),0);
00064 copy(parser.strikestep.begin(),parser.strikestep.end(),strikestep.begin());
00065 strikesizes.assign(parser.strikesizes.size(),0);
00066 copy(parser.strikesizes.begin(),parser.strikesizes.end(),strikesizes.begin());
00067 weights.assign(parser.weights.size(),0);
00068 copy(parser.weights.begin(),parser.weights.end(),weights.begin());
00069 conddiffweight= parser.conddiffweight;
00070 anisotropyweight= parser.anisotropyweight;
00071 strikediffweight= parser.strikediffweight;
00072 }
00073 
00074 void MTAnisoGAConf::WriteData(string filename)
00075 {
00076 ofstream confout(filename.c_str());
00077 WriteData(confout);}
00078 
00079 void MTAnisoGAConf::WriteData(std::ofstream &outstream)
00080 {
00081 outstream << "verbose"  << "=" ;
00082 outstream << (verbose ? "true" : "false") << endl;
00083 outstream << "mtfitexponent"  << "=" ;
00084 outstream << mtfitexponent << endl;
00085 outstream << "popsize"  << "=" ;
00086 outstream << popsize << endl;
00087 outstream << "inittemp"  << "=" ;
00088 outstream << inittemp << endl;
00089 outstream << "coolingratio"  << "=" ;
00090 outstream << coolingratio << endl;
00091 outstream << "generations"  << "=" ;
00092 outstream << generations << endl;
00093 outstream << "mutationprob"  << "=" ;
00094 outstream << mutationprob << endl;
00095 outstream << "crossoverprob"  << "=" ;
00096 outstream << crossoverprob << endl;
00097 outstream << "threads"  << "=" ;
00098 outstream << threads << endl;
00099 outstream << "starttime"  << "=" ;
00100 outstream << starttime << endl;
00101 outstream << "endtime"  << "=" ;
00102 outstream << endtime << endl;
00103 outstream << "tensorerror"  << "=" ;
00104 outstream << tensorerror << endl;
00105 outstream << "reserror"  << "=" ;
00106 outstream << reserror << endl;
00107 outstream << "phaseerror"  << "=" ;
00108 outstream << phaseerror << endl;
00109 outstream << "gatype"  << "=" ;
00110 outstream << gatype << endl;
00111 outstream << "outputbase"  << "=" ;
00112 outstream << outputbase << endl;
00113 outstream << "mode"  << "=" ;
00114 outstream << mode << endl;
00115 outstream << "mtfit"  << "=" ;
00116 outstream << mtfit << endl;
00117 outstream << "mtinputdata"  << "=" ;
00118 outstream << mtinputdata << endl;
00119 outstream << "ptensordata"  << "=" ;
00120 outstream << ptensordata << endl;
00121 outstream << "annealinggeneration"  << "=" ;
00122 outstream << annealinggeneration << endl;
00123 outstream << "elitist"  << "=" ;
00124 outstream << (elitist ? "true" : "false") << endl;
00125 outstream << "thickbase"  << "=" ;
00126 for (size_t i = 0; i < thickbase.size(); ++i)
00127   outstream << thickbase.at(i) << " "; 
00128 outstream << endl;
00129 
00130 outstream << "thickstep"  << "=" ;
00131 for (size_t i = 0; i < thickstep.size(); ++i)
00132   outstream << thickstep.at(i) << " "; 
00133 outstream << endl;
00134 
00135 outstream << "thicksizes"  << "=" ;
00136 for (size_t i = 0; i < thicksizes.size(); ++i)
00137   outstream << thicksizes.at(i) << " "; 
00138 outstream << endl;
00139 
00140 outstream << "resbase"  << "=" ;
00141 for (size_t i = 0; i < resbase.size(); ++i)
00142   outstream << resbase.at(i) << " "; 
00143 outstream << endl;
00144 
00145 outstream << "resstep"  << "=" ;
00146 for (size_t i = 0; i < resstep.size(); ++i)
00147   outstream << resstep.at(i) << " "; 
00148 outstream << endl;
00149 
00150 outstream << "ressizes"  << "=" ;
00151 for (size_t i = 0; i < ressizes.size(); ++i)
00152   outstream << ressizes.at(i) << " "; 
00153 outstream << endl;
00154 
00155 outstream << "anisobase"  << "=" ;
00156 for (size_t i = 0; i < anisobase.size(); ++i)
00157   outstream << anisobase.at(i) << " "; 
00158 outstream << endl;
00159 
00160 outstream << "anisostep"  << "=" ;
00161 for (size_t i = 0; i < anisostep.size(); ++i)
00162   outstream << anisostep.at(i) << " "; 
00163 outstream << endl;
00164 
00165 outstream << "anisosizes"  << "=" ;
00166 for (size_t i = 0; i < anisosizes.size(); ++i)
00167   outstream << anisosizes.at(i) << " "; 
00168 outstream << endl;
00169 
00170 outstream << "strikebase"  << "=" ;
00171 for (size_t i = 0; i < strikebase.size(); ++i)
00172   outstream << strikebase.at(i) << " "; 
00173 outstream << endl;
00174 
00175 outstream << "strikestep"  << "=" ;
00176 for (size_t i = 0; i < strikestep.size(); ++i)
00177   outstream << strikestep.at(i) << " "; 
00178 outstream << endl;
00179 
00180 outstream << "strikesizes"  << "=" ;
00181 for (size_t i = 0; i < strikesizes.size(); ++i)
00182   outstream << strikesizes.at(i) << " "; 
00183 outstream << endl;
00184 
00185 outstream << "weights"  << "=" ;
00186 for (size_t i = 0; i < weights.size(); ++i)
00187   outstream << weights.at(i) << " "; 
00188 outstream << endl;
00189 
00190 outstream << "conddiffweight"  << "=" ;
00191 outstream << conddiffweight << endl;
00192 outstream << "anisotropyweight"  << "=" ;
00193 outstream << anisotropyweight << endl;
00194 outstream << "strikediffweight"  << "=" ;
00195 outstream << strikediffweight << endl;
00196 }
00197 

Generated on Tue May 4 16:52:14 2010 for GPLIB++ by  doxygen 1.5.8