Ejemplo n.º 1
0
/*!
 *  \brief Write an MCC fitness object into a Beagle XML streamer.
 *  \param ioStreamer XML streamer to use to write the fitness values.
 *  \param inIndent Whether XML output should be indented.
 */
void GP::FitnessMCC::writeContent(PACC::XML::Streamer& ioStreamer, bool inIndent) const
{
	Beagle_StackTraceBeginM();
	ioStreamer.openTag("MCC", false);
	ioStreamer.insertStringContent(dbl2str(mValue));
	ioStreamer.closeTag();
	ioStreamer.openTag("TruePositives", false);
	ioStreamer.insertStringContent(dbl2str(mTruePositives));
	ioStreamer.closeTag();
	ioStreamer.openTag("FalsePositives", false);
	ioStreamer.insertStringContent(dbl2str(mFalsePositives));
	ioStreamer.closeTag();
	ioStreamer.openTag("TrueNegatives", false);
	ioStreamer.insertStringContent(dbl2str(mTrueNegatives));
	ioStreamer.closeTag();
	ioStreamer.openTag("FalseNegatives", false);
	ioStreamer.insertStringContent(uint2str(mFalseNegatives));
	ioStreamer.closeTag();
	ioStreamer.openTag("TruePositivesRel", false);
	ioStreamer.insertStringContent(dbl2str(mTruePositivesRel));
	ioStreamer.closeTag();
	ioStreamer.openTag("FalsePositivesRel", false);
	ioStreamer.insertStringContent(dbl2str(mFalsePositivesRel));
	ioStreamer.closeTag();
	ioStreamer.openTag("TrueNegativesRel", false);
	ioStreamer.insertStringContent(dbl2str(mTrueNegativesRel));
	ioStreamer.closeTag();
	ioStreamer.openTag("FalseNegativesRel", false);
	ioStreamer.insertStringContent(dbl2str(mFalseNegativesRel));
	ioStreamer.closeTag();
	Beagle_StackTraceEndM("void GP::FitnessMCC::writeContent(PACC::XML::Streamer&, bool) const");
}
Ejemplo n.º 2
0
void Beagle::WrapperT<T>::write(PACC::XML::Streamer& ioStreamer, bool inIndent) const
{
	Beagle_StackTraceBeginM();
	std::ostringstream lOSS;
	lOSS << mWrappedValue << std::flush;
	ioStreamer.insertStringContent(lOSS.str(), false);
	Beagle_StackTraceEndM();
}
/*!
 *  \brief Write a Koza's fitness into a Beagle XML streamer.
 *  \param ioStreamer XML streamer to use to write the fitness values.
 *  \param inIndent Whether XML output should be indented.
 */
void GP::FitnessKoza::writeContent(PACC::XML::Streamer& ioStreamer, bool inIndent) const
{
	Beagle_StackTraceBeginM();
	ioStreamer.openTag("Normalized", false);
	ioStreamer.insertStringContent(dbl2str(mValue));
	ioStreamer.closeTag();
	ioStreamer.openTag("Adjusted", false);
	ioStreamer.insertStringContent(dbl2str(mAdjustedFitness));
	ioStreamer.closeTag();
	ioStreamer.openTag("Standardized", false);
	ioStreamer.insertStringContent(dbl2str(mStandardizedFitness));
	ioStreamer.closeTag();
	ioStreamer.openTag("Raw", false);
	ioStreamer.insertStringContent(dbl2str(mRawFitness));
	ioStreamer.closeTag();
	ioStreamer.openTag("Hits", false);
	ioStreamer.insertStringContent(uint2str(mHits));
	ioStreamer.closeTag();
	Beagle_StackTraceEndM("void GP::FitnessKoza::writeContent(PACC::XML::Streamer&, bool) const");
}
Ejemplo n.º 4
0
/*!
 *  \brief Write a multiobjective fitness into an XML streamer.
 *  \param ioStreamer XML streamer to use to write the fitness value.
 *  \param inIndent Whether XML output should be indented.
 */
void FitnessMultiObj::writeContent(PACC::XML::Streamer& ioStreamer, bool inIndent) const
{
	Beagle_StackTraceBeginM();
	ioStreamer.insertAttribute("size", uint2str(size()));
	for(unsigned int i=0; i<size(); ++i) {
		ioStreamer.openTag("Obj", false);
		ioStreamer.insertStringContent(dbl2str((*this)[i]));
		ioStreamer.closeTag();
	}
	Beagle_StackTraceEndM();
}
/*!
 *  \brief Write a float vector into a XML streamer.
 *  \param ioStreamer XML streamer into which the float vector is written.
 *  \param inIndent Whether output should be indented.
 */
void GA::IntegerVector::writeContent(PACC::XML::Streamer& ioStreamer, bool inIndent) const
{
	Beagle_StackTraceBeginM();
	ioStreamer.insertAttribute("size", uint2str(size()));
	std::ostringstream lOSS;
	for(unsigned int i=0; i<size(); ++i) {
		lOSS << (*this)[i];
		if(i!=(size()-1)) lOSS << ';';
	}
	ioStreamer.insertStringContent(lOSS.str());
	Beagle_StackTraceEndM("void GA::IntegerVector::writeContent(PACC::XML::Streamer& ioStreamer, bool inIndent) const");
}
Ejemplo n.º 6
0
/*!
 *  \brief Write an ES vector into a XML streamer.
 *  \param ioStreamer XML streamer into which the ES vector is written.
 *  \param inIndent Whether output should be indented.
 */
void GA::ESVector::writeContent(PACC::XML::Streamer& ioStreamer, bool inIndent) const
{
	Beagle_StackTraceBeginM();
	ioStreamer.insertAttribute("size", uint2str(size()));
	std::ostringstream lOSS;
	for(unsigned int i=0; i<size(); i++) {
		lOSS << '(' << (*this)[i].mValue << ',' << (*this)[i].mStrategy << ')';
		if(i!=(size()-1)) lOSS << '/';
	}
	ioStreamer.insertStringContent(lOSS.str());
	Beagle_StackTraceEndM("void GA::ESVector::write(PACC::XML::Streamer&,bool) const");
}
Ejemplo n.º 7
0
void SCHNAPS::Core::ArrayT<T>::write(PACC::XML::Streamer& ioStreamer, bool inIndent) const {
	schnaps_StackTraceBeginM();
	std::ostringstream lOSS;
	for (unsigned int i = 0; i < std::vector<T>::size(); ++i) {
		lOSS << (*this)[i];
		if (i != (std::vector<T>::size() - 1)) {
			lOSS << ',';
		}
	}
	ioStreamer.insertStringContent(lOSS.str());
	schnaps_StackTraceEndM("void SCHNAPS::Core::ArrayT<T>::write(PACC::XML::Streamer&, bool) const");
}
Ejemplo n.º 8
0
/*!
 *  \brief Write a stats into a XML streamer.
 *  \param ioStreamer XML streamer used to write the stats into.
 *  \param inIndent Whether XML output should be indented.
 */
void Stats::writeContent(PACC::XML::Streamer& ioStreamer, bool inIndent) const
{
	Beagle_StackTraceBeginM();
	if(mValid) {
		if(mID.empty() == false) ioStreamer.insertAttribute("id", mID);
		ioStreamer.insertAttribute("generation", uint2str(mGeneration));
		ioStreamer.insertAttribute("popsize", uint2str(mPopSize));
		std::set<std::string> lSortedItemKey;
		for(ItemMap::const_iterator lIterMap=mItemMap.begin(); lIterMap!=mItemMap.end(); ++lIterMap) {
			lSortedItemKey.insert(lIterMap->first);
		}
		for(std::set<std::string>::const_iterator lIterSet=lSortedItemKey.begin();
		    lIterSet!=lSortedItemKey.end(); ++lIterSet) {
			ioStreamer.openTag("Item", false);
			ioStreamer.insertAttribute("key", *lIterSet);
			ItemMap::const_iterator lIterMap = mItemMap.find(*lIterSet);
			ioStreamer.insertStringContent(dbl2str(lIterMap->second,12));
			ioStreamer.closeTag();
		}
		for(unsigned int i=0; i<size(); ++i) {
			ioStreamer.openTag("Measure", inIndent);
			ioStreamer.insertAttribute("id", (*this)[i].mID);
			ioStreamer.openTag("Avg", false);
			ioStreamer.insertStringContent(dbl2str((*this)[i].mAvg,12));
			ioStreamer.closeTag();
			ioStreamer.openTag("Std", false);
			ioStreamer.insertStringContent(dbl2str((*this)[i].mStd,12));
			ioStreamer.closeTag();
			ioStreamer.openTag("Max", false);
			ioStreamer.insertStringContent(dbl2str((*this)[i].mMax,12));
			ioStreamer.closeTag();
			ioStreamer.openTag("Min", false);
			ioStreamer.insertStringContent(dbl2str((*this)[i].mMin,12));
			ioStreamer.closeTag();
			ioStreamer.closeTag();
		}
	} else ioStreamer.insertAttribute("valid", "no");
	Beagle_StackTraceEndM("void Stats::writeContent(PACC::XML::Streamer&,bool) const");
}
Ejemplo n.º 9
0
/*!
 *  \brief Write a matrix into a XML streamer.
 *  \param ioStreamer XML streamer to use.
 *  \param inIndent Whether output should be indented.
 */
void Matrix::write(PACC::XML::Streamer& ioStreamer, bool inIndent) const
{
	Beagle_StackTraceBeginM();
	ioStreamer.insertStringContent(PACC::Matrix::serialize());
	Beagle_StackTraceEndM();
}
Ejemplo n.º 10
0
/*!
 *  \brief Write the state of the quasi-random generator into a XML streamer.
 *  \param ioStreamer XML streamer to write the randomizer into.
 *  \param inIndent Whether output should be indented.
 */
void QuasiRandom::writeContent(PACC::XML::Streamer& ioStreamer, bool inIndent) const
{
	Beagle_StackTraceBeginM();
	if(getDimensionality() != 0) ioStreamer.insertStringContent(getState());
	Beagle_StackTraceEndM("void QuasiRandom::writeContent(PACC::XML::Streamer& ioStreamer, bool inIndent) const");
}
void BGFitness::write(PACC::XML::Streamer& ioStreamer, bool inIndent) const {
	//	Beagle_StackTraceBeginM();
	ioStreamer.openTag("Fitness", inIndent);
	ioStreamer.insertAttribute("type", "LogFitness");
	if(isValid()) {
		ioStreamer.openTag("Obj", inIndent);

		ioStreamer.insertStringContent(dbl2str(mFitness).c_str());

		ioStreamer.closeTag();
		ioStreamer.openTag("OriObj", inIndent);
		
		ioStreamer.insertStringContent(dbl2str(mOriginalFitness).c_str());
		
		ioStreamer.closeTag();
		
		//State Matrix
		ioStreamer.openTag("StateMatrices",inIndent);
//		MatrixInterface lInterface;		
		for(unsigned int i = 0; i < mStateMatrices.size(); ++i) {
			mStateMatrices[i].write(ioStreamer);
//			lInterface.write(mStateMatrices[i],ioStreamer);
		}
		ioStreamer.closeTag();
		
		if(mDataSet.size() == 0) {
			for(unsigned int i = 0; i < mVariableData.size(); ++i) {
				ioStreamer.openTag("Data", false);
				ioStreamer.insertAttribute("Name", mVariableName[i]);
				ioStreamer.insertAttribute("usize", uint2str(mUncompressedSize[i]));
				ioStreamer.insertStringContent(mVariableData[i]);
				ioStreamer.closeTag();
			}
		} else {
			for(std::map<unsigned int, double>::const_iterator lIter = mDataSet.begin(); lIter != mDataSet.end(); ++lIter) {
				ioStreamer.openTag("DataSet", inIndent);
				ioStreamer.insertAttribute("ID", uint2str(lIter->first));
				ioStreamer.openTag("Obj", false);
				ioStreamer.insertStringContent( dbl2str(lIter->second).c_str() );
				ioStreamer.closeTag();
				for(unsigned int i = 0; i < mVariableData.size(); ++i) {
					if(lIter->first == mVariableDataSet[i]) {
						ioStreamer.openTag("Data", false);
						ioStreamer.insertAttribute("Name", mVariableName[i]);
						ioStreamer.insertAttribute("usize", uint2str(mUncompressedSize[i]));
						ioStreamer.insertStringContent(mVariableData[i]);
						ioStreamer.closeTag();
					}
				}
				ioStreamer.closeTag();
			}
		}
		
		if(!mInfo.empty()) {
			ioStreamer.openTag("Info", inIndent);
			for(std::map<std::string,std::string>::const_iterator lIter = mInfo.begin(); lIter != mInfo.end(); ++lIter) {
				ioStreamer.openTag(lIter->first, false);
				ioStreamer.insertStringContent( lIter->second );
				ioStreamer.closeTag();
			}		
			ioStreamer.closeTag();
		}
		if(mBondGraph!=NULL) {
			mBondGraph->write(ioStreamer,false);
		}
		if(mSimplifiedBondGraph!=NULL) {
			ioStreamer.openTag("SimplifiedBondGraph", inIndent);
			mSimplifiedBondGraph->write(ioStreamer,false);
			ioStreamer.closeTag();
		}
		
	}
	else ioStreamer.insertAttribute("valid", "no");
	ioStreamer.closeTag();
	//	Beagle_StackTraceEndM("void LogFitness::write(PACC::XML::Streamer& ioStreamer, bool inIndent) const");
}