Exemplo n.º 1
0
/*!
 *  \brief Write a history entry into a XML streamer.
 *  \param ioStreamer XML streamer to use.
 *  \param inIndent Whether XML output should be indented.
 */
void HistoryEntry::write(PACC::XML::Streamer& ioStreamer, bool inIndent) const
{
	Beagle_StackTraceBeginM();

	ioStreamer.openTag("Entry", inIndent);
	ioStreamer.insertAttribute("var", uint2str(mIndividualVar));
	ioStreamer.insertAttribute("generation", uint2str(mGeneration));

	for(unsigned int i=0; i<mParents.size(); ++i) {
		ioStreamer.openTag("Parent", inIndent);
		ioStreamer.insertAttribute("id", uint2str(mParents[i].getID()));
		ioStreamer.insertAttribute("var", uint2str(mParents[i].getVar()));
		ioStreamer.closeTag();
	}

	for(unsigned int i=0; i<mOpNames.size(); ++i) {
		ioStreamer.openTag("Operations", inIndent);
		ioStreamer.insertAttribute("action", mActions[i]);
		ioStreamer.insertAttribute("opname", mOpNames[i]);
		ioStreamer.closeTag();
	}

	ioStreamer.closeTag();

	Beagle_StackTraceEndM();
}
Exemplo n.º 2
0
/*!
 *  \brief Write recombination operator content into XML streamer.
 *  \param ioStreamer XML streamer to write recombination operator into.
 *  \param inIndent Whether output should be indented.
 */
void RecombinationOp::writeContent(PACC::XML::Streamer& ioStreamer, bool inIndent) const
{
	Beagle_StackTraceBeginM();
	ioStreamer.insertAttribute("recombpb", mRecombProbaName);
	ioStreamer.insertAttribute("nbrindrecomb", mNumberRecombName);
	Beagle_StackTraceEndM();
}
/*!
 *  \brief Write an max hits termination operator into a XML stream.
 *  \param ioStreamer XML streamer in which the operator is written.
 *  \param inIndent Whether XML output should be indented.
 */
void GP::TermMaxHitsOp::write(PACC::XML::Streamer& ioStreamer, bool inIndent) const
{
	Beagle_StackTraceBeginM();
	ioStreamer.openTag(getName(), inIndent);
	if(mMaxHits != NULL) ioStreamer.insertAttribute("hits", uint2str(mMaxHits->getWrappedValue()));
	else ioStreamer.insertAttribute("hits", uint2str(mMaxHitsDefault));
	ioStreamer.closeTag();
	Beagle_StackTraceEndM("void GP::TermMaxHitsOp::write(PACC::XML::Streamer& ioStreamer, bool inIndent) const");
}
Exemplo n.º 4
0
/*!
 *  \brief Write Gaussian mutation operator into XML streamer.
 *  \param ioStreamer XML streamer to write mutation operator into.
 *  \param inIndent Whether XML output should be indented.
 */
void FltVec::MutationGaussianOp::writeContent(PACC::XML::Streamer& ioStreamer, bool inIndent) const
{
	Beagle_StackTraceBeginM();
	EC::MutationOp::writeContent(ioStreamer, inIndent);
	ioStreamer.insertAttribute("mutfloatpb", mMutateFloatPbName);
	ioStreamer.insertAttribute("mutgaussmu", mMutateGaussMuName);
	ioStreamer.insertAttribute("mutgausssigma", mMutateGaussSigmaName);
	Beagle_StackTraceEndM();
}
Exemplo n.º 5
0
/*!
 *  \brief Write a max fitness termination operator into a XML stream.
 *  \param ioStreamer XML stream in which the operator is written.
 *  \param inIndent Whether XML output should be indented.
 */
void TermMaxFitnessOp::write(PACC::XML::Streamer& ioStreamer, bool inIndent) const
{
	Beagle_StackTraceBeginM();
	ioStreamer.openTag(getName(), inIndent);
	if(mMaxFitness != NULL)
		ioStreamer.insertAttribute("fitness", dbl2str(mMaxFitness->getWrappedValue()));
	else ioStreamer.insertAttribute("fitness", dbl2str(mMaxFitnessDefault));
	ioStreamer.closeTag();
	Beagle_StackTraceEndM();
}
Exemplo n.º 6
0
void FitnessNMSE::write(PACC::XML::Streamer& ioStreamer, bool inIndent) const
{
    Beagle_StackTraceBeginM();
    ioStreamer.openTag("FitnessNMSE", inIndent);
    ioStreamer.insertAttribute("NMSE", dbl2str(mNMSE));
    for(unsigned i=0; i<size(); ++i) {
        ioStreamer.openTag("y" + int2str(i), inIndent);
        ioStreamer.insertAttribute("NMSE", dbl2str((*this)[i].nmse));
        ioStreamer.insertAttribute("MSE", dbl2str((*this)[i].mse));
        ioStreamer.closeTag();
    }
    ioStreamer.closeTag();
    Beagle_StackTraceEndM("void FitnessSimple::write(PACC::XML::Streamer& ioStreamer, bool inIndent) const");
}
/*!
 *  \brief Write uniform mutation operator into XML streamer.
 *  \param ioStreamer XML streamer to write mutation operator into.
 *  \param inIndent Whether XML output should be indented.
 */
void GA::MutationUniformIntVecOp::writeContent(PACC::XML::Streamer& ioStreamer, bool inIndent) const
{
	Beagle_StackTraceBeginM();
	Beagle::MutationOp::writeContent(ioStreamer, inIndent);
	ioStreamer.insertAttribute("mutintpb", mIntMutatePbName);
	Beagle_StackTraceEndM("void GA::MutationUniformIntVecOp::writeContent(PACC::XML::Streamer& ioStreamer, bool inIndent) const");
}
/*!
 *  \brief Write ES mutation operator into XML streamer.
 *  \param ioStreamer XML streamer to write mutation operator into.
 *  \param inIndent Whether XML output should be indented.
 */
void GA::MutationESVecOp::writeContent(PACC::XML::Streamer& ioStreamer, bool inIndent) const
{
	Beagle_StackTraceBeginM();
	Beagle::MutationOp::writeContent(ioStreamer, inIndent);
	ioStreamer.insertAttribute("minstrategy", mMinStrategyName);
	Beagle_StackTraceEndM("void GA::MutationESVecOp::writeContent(PACC::XML::Streamer& ioStreamer, bool inIndent) const");
}
/*!
 *  \brief Write crossover operator into XML streamer.
 *  \param ioStreamer XML streamer to write crossover operator into.
 *  \param inIndent Whether XML output should be indented.
 */
void GP::CrossoverOp::writeContent(PACC::XML::Streamer& ioStreamer, bool inIndent) const
{
	Beagle_StackTraceBeginM();
	Beagle::CrossoverOp::writeContent(ioStreamer, inIndent);
	ioStreamer.insertAttribute("distrpb", mDistribPbName);
	Beagle_StackTraceEndM("void GP::CrossoverOp::writeContent(PACC::XML::Streamer& ioStreamer, bool inIndent) const");
}
Exemplo n.º 10
0
/*!
 *  \brief Write sigma adaptation operator into XML streamer.
 *  \param ioStreamer XML streamer to write adaptation operator into.
 *  \param inIndent Whether XML output should be indented.
 */
void ES::AdaptOneFifthRuleOp::writeContent(PACC::XML::Streamer& ioStreamer, bool inIndent) const
{
	Beagle_StackTraceBeginM();
	Beagle::BreederOp::writeContent(ioStreamer, inIndent);
	ioStreamer.insertAttribute("mutgausssigma", mMutateGaussSigmaName);
	Beagle_StackTraceEndM();
}
Exemplo n.º 11
0
/*!
 *  \brief Write flip bit mutation operator into XML streamer.
 *  \param ioStreamer XML streamer to write mutation operator into.
 *  \param inIndent Whether XML output should be indented.
 */
void BitStr::MutationFlipBitOp::writeContent(PACC::XML::Streamer& ioStreamer, bool inIndent) const
{
	Beagle_StackTraceBeginM();
	EC::MutationOp::writeContent(ioStreamer, inIndent);
	ioStreamer.insertAttribute("mutbitpb", mBitMutatePbName);
	Beagle_StackTraceEndM();
}
Exemplo n.º 12
0
/*!
 *  \brief Write mutation operator into XML streamer.
 *  \param ioStreamer XML streamer to write mutation operator into.
 *  \param inIndent Whether XML output should be indented.
 */
void GP::MutationSwapSubtreeOp::writeContent(PACC::XML::Streamer& ioStreamer, bool inIndent) const
{
	Beagle_StackTraceBeginM();
	Beagle::MutationOp::writeContent(ioStreamer, inIndent);
	ioStreamer.insertAttribute("distrpb", mDistribPbName);
	Beagle_StackTraceEndM();
}
Exemplo n.º 13
0
/*!
 *  \brief Write crossover operator content into XML streamer.
 *  \param ioStreamer XML streamer to write crossover operator into.
 *  \param inIndent Whether output should be indented.
 */
void CrossoverOp::writeContent(PACC::XML::Streamer& ioStreamer, bool inIndent) const
{
	Beagle_StackTraceBeginM();

	ioStreamer.insertAttribute("matingpb", mMatingProbaName);

	Beagle_StackTraceEndM();
}
Exemplo n.º 14
0
void PopulationManager::writeContent(PACC::XML::Streamer& ioStreamer, bool inIndent) const {
	schnaps_StackTraceBeginM();
	// write generator
	mGenerator->write(ioStreamer, inIndent);

	// write population source
	ioStreamer.openTag("Population");
	for (PopulationManager::const_iterator lIt = this->begin(); lIt != this->end(); lIt++) {
		ioStreamer.openTag("SubPopulation");
		ioStreamer.insertAttribute("time", SCHNAPS::uint2str(lIt->first));
		ioStreamer.insertAttribute("profile", lIt->second.mProfile);
		ioStreamer.insertAttribute("size", SCHNAPS::uint2str(lIt->second.mSize));
		ioStreamer.closeTag();
	}
	ioStreamer.closeTag();
	schnaps_StackTraceEndM("void SCHNAPS::Simulation::PopulationManager::writeContent(PACC::XML::Streamer&, bool) const");
}
void Beagle::GP::MutationEphemeralOpT<T>::writeContent(PACC::XML::Streamer& ioStreamer,
        bool inIndent) const
{
	Beagle_StackTraceBeginM();
	Beagle::MutationOp::writeContent(ioStreamer, inIndent);
	ioStreamer.insertAttribute("primitname", mEphemeralNameParamName);
	Beagle_StackTraceEndM("void GP::MutationEphemeralOpT<T>::writeContent(PACC::XML::Streamer& ioStreamer, bool inIndent) const");
}
Exemplo n.º 16
0
/*!
 *  \brief Write a genotype into a XML streamer.
 *  \param ioStreamer XML streamer to use.
 *  \param inIndent Whether XML output should be indented.
 */
void Genotype::write(PACC::XML::Streamer& ioStreamer, bool inIndent) const
{
	Beagle_StackTraceBeginM();
	ioStreamer.openTag("Genotype", inIndent);
	ioStreamer.insertAttribute("type", getType());
	writeContent(ioStreamer, inIndent);
	ioStreamer.closeTag();
	Beagle_StackTraceEndM("void Genotype::write(PACC::XML::Streamer&,bool) const");
}
Exemplo n.º 17
0
/*!
 * \brief Write object content to XML.
 * \param ioStreamer XML streamer to output document.
 * \param inIndent Wether to indent or not.
 * \throw SCHNAPS::Core::AssertException if 
 */
void PrimitiveTree::writeContent(PACC::XML::Streamer& ioStreamer, bool inIndent) const {
	schnaps_StackTraceBeginM();
	ioStreamer.insertAttribute("size", uint2str(size()));
	if(size() > 0) {
		unsigned int lSizeSubTree = writeSubTree(ioStreamer, 0, inIndent);
		schnaps_AssertM(lSizeSubTree == size());
	}
	schnaps_StackTraceEndM("void SCHNAPS::Core::PrimitiveTree::writeContent(PACC::XML::Streamer&, bool) const");
}
Exemplo n.º 18
0
/*!
 *  \brief Write concept map of the factory into a XML streamer.
 *  \param ioStreamer XML streamer to write factory concept map into.
 *  \param inIndent Whether XML output should be indented.
 */
void Factory::write(PACC::XML::Streamer& ioStreamer, bool inIndent) const
{
	Beagle_StackTraceBeginM();
	ioStreamer.openTag("Factory", inIndent);
	std::map< std::string, std::string > lSortedMap;
	for(Factory::ConceptMap::const_iterator lIter=mConceptMap.begin();
	        lIter!=mConceptMap.end(); ++lIter) {
		lSortedMap[lIter->first] = lIter->second;
	}
	for(std::map< std::string, std::string >::const_iterator lIterSM=lSortedMap.begin();
	        lIterSM!=lSortedMap.end(); ++lIterSM) {
		ioStreamer.openTag("Concept", false);
		ioStreamer.insertAttribute("name", lIterSM->first);
		ioStreamer.insertAttribute("type", lIterSM->second);
		ioStreamer.closeTag();
	}
	ioStreamer.closeTag();
	Beagle_StackTraceEndM();
}
Exemplo n.º 19
0
/*!
 *  \brief Write OversizeOp operator into XML streamer.
 *  \param ioStreamer XML streamer to write OversizeOp operator into.
 *  \param inIndent Whether XML output should be indented.
 */
void OversizeOp::write(PACC::XML::Streamer& ioStreamer, bool inIndent) const
{
	Beagle_StackTraceBeginM();
	ioStreamer.openTag(getName(), inIndent);
	ioStreamer.insertAttribute("ratio_name", mOversizeRatioName);
	for(BreederNode::Handle lNode=getRootNode(); lNode!=NULL; lNode=lNode->getNextSibling()) {
		lNode->write(ioStreamer, inIndent);
	}
	ioStreamer.closeTag();
	Beagle_StackTraceEndM("void OversizeOp::write(PACC::XML::Streamer& ioStreamer, bool inIndent) const");
}
Exemplo n.º 20
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();
}
Exemplo n.º 21
0
/*!
 *  \brief Write fitness of an individual into a XML streamer.
 *  \param ioStreamer XML streamer to write the fitness into.
 *  \param inIndent Whether XML output should be indented.
 */
void Individual::writeFitness(PACC::XML::Streamer& ioStreamer, bool inIndent) const
{
	Beagle_StackTraceBeginM();
	if(mFitness == NULL) {
		ioStreamer.openTag("Fitness", false);
		ioStreamer.insertAttribute("valid", "no");
		ioStreamer.closeTag();
	} else {
		mFitness->write(ioStreamer, inIndent);
	}
	Beagle_StackTraceEndM();
}
Exemplo n.º 22
0
/*!
 *  \brief Write the actual vivarium population in a XML streamer.
 *  \param ioStreamer XML streamer to write the vivarium population into.
 *  \param inIndent Whether XML output should be indented.
 */
void Vivarium::writePopulation(PACC::XML::Streamer& ioStreamer, bool inIndent) const
{
	Beagle_StackTraceBeginM();
	ioStreamer.openTag("Population", inIndent);
	ioStreamer.insertAttribute("size", uint2str(size()));
	for(unsigned int i=0; i<size(); ++i) {
		Beagle_NonNullPointerAssertM((*this)[i]);
		(*this)[i]->write(ioStreamer, inIndent);
	}
	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");
}
Exemplo n.º 24
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");
}
Exemplo n.º 25
0
/*!
 *  \brief Write members of the vivarium in a XML streamer.
 *  \param ioStreamer XML streamer to write the members into.
 *  \param inIndent Whether XML output should be indented.
 */
void Vivarium::writeMembers(PACC::XML::Streamer& ioStreamer, bool inIndent) const
{
	Beagle_StackTraceBeginM();
	for(MemberMap::const_iterator lIterMap=mMemberMap.begin();
	        lIterMap!=mMemberMap.end(); ++lIterMap) {
		ioStreamer.openTag(lIterMap->first, inIndent);
		Member::Handle lMember = castHandleT<Member>(lIterMap->second);
		ioStreamer.insertAttribute("type", lMember->getType());
		lMember->writeContent(ioStreamer, inIndent);
		ioStreamer.closeTag();
	}
	Beagle_StackTraceEndM();
}
void TreeSTag::write(PACC::XML::Streamer& ioStreamer, bool inIndent) const {
	Beagle_StackTraceBeginM();
	
	ioStreamer.openTag("Genotype", inIndent);
	ioStreamer.insertAttribute("type", "gptreetag");
	ioStreamer.insertAttribute("structureid", uint2str(mStructureID));
	ioStreamer.insertAttribute("size", uint2str(size()));
	ioStreamer.insertAttribute("depth", uint2str(getTreeDepth()));
	ioStreamer.insertAttribute("primitSetId", uint2str(getPrimitiveSetIndex()));
	ioStreamer.insertAttribute("nbArgs", uint2str(getNumberArguments()));
	if(size() > 0) {
		unsigned int lSizeSubTree = writeSubTree(ioStreamer, 0, inIndent);
		Beagle_AssertM(lSizeSubTree == size());
	}
	ioStreamer.closeTag();
	
//	if(mBondGraph!=NULL) {
//		mBondGraph->write(ioStreamer,inIndent);
//	} 
	
	Beagle_StackTraceEndM("void GP::Tree::write(PACC::XML::Streamer& ioStreamer, bool inIndent) const");
}
Exemplo n.º 27
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");
}
Exemplo n.º 28
0
/*!
 * \brief Write object content to XML.
 * \param ioStreamer XML streamer to output document.
 * \param inIndent Wether to indent or not.
 */
void BranchMulti::writeContent(PACC::XML::Streamer& ioStreamer, bool inIndent) const {
	schnaps_StackTraceBeginM();
	ioStreamer.insertAttribute("inProbabilities", mProbabilities_Ref);
	schnaps_StackTraceEndM("void SCHNAPS::Plugins::Control::BranchMulti::writeContent(PACC::XML::Streamer&, bool) const");
}
Exemplo n.º 29
0
/*!
 *  \brief Write initialization operator into XML streamer.
 *  \param ioStreamer XML streamer to write initialization operator into.
 *  \param inIndent Whether output should be indented.
 */
void InitializationOp::writeContent(PACC::XML::Streamer& ioStreamer, bool inIndent) const
{
	Beagle_StackTraceBeginM();
	ioStreamer.insertAttribute("repropb", mReproProbaName);
	Beagle_StackTraceEndM();
}
Exemplo n.º 30
0
/*!
 *  \brief Write the content of a primitive into a XML stream.
 *  \param ioStreamer Streamer to write primitive into.
 *  \param inIndent Whether XML output should be indented.
 */
void GP::Invoker::writeContent(PACC::XML::Streamer& ioStreamer, bool inIndent) const
{
	Beagle_StackTraceBeginM();
	if(mIndex!=eGenerator) ioStreamer.insertAttribute("id", uint2str(mIndex));
	Beagle_StackTraceEndM("void GP::Invoker::writeContent(PACC::XML::Streamer& ioStreamer, bool inIndent) const");
}