Ejemplo n.º 1
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();
}
Ejemplo n.º 2
0
/*!
 *  \brief Write an instruction super set into a Beagle XML stream.
 *  \param ioStreamer XMl streamer to write the super set into.
 *  \param inIndent Whether XML output should be indented.
 */
void LinGP::InstructionSuperSet::write(PACC::XML::Streamer& ioStreamer, bool inIndent) const
{
	ioStreamer.openTag("InstructionSuperSet", inIndent);
	for(unsigned int i=0; i<mInstructionSets.size(); i++) {
		mInstructionSets[i]->write(ioStreamer);
	}
	ioStreamer.closeTag();
}
/*!
 *  \brief Write a primitive super set into a Beagle XML stream.
 *  \param ioStreamer XMl streamer to write the super set into.
 *  \param inIndent Whether XML output should be indented.
 */
void GP::PrimitiveSuperSet::write(PACC::XML::Streamer& ioStreamer, bool inIndent) const
{
	Beagle_StackTraceBeginM();
	ioStreamer.openTag("GP-PrimitiveSuperSet", inIndent);
	for(unsigned int i=0; i<mPrimitSets.size(); i++) mPrimitSets[i]->write(ioStreamer, inIndent);
	ioStreamer.closeTag();
	Beagle_StackTraceEndM("void GP::PrimitiveSuperSet::write(PACC::XML::Streamer& ioStreamer, bool inIndent) const");
}
Ejemplo n.º 4
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");
}
/*!
 *  \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");
}
Ejemplo n.º 6
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();
}
Ejemplo n.º 7
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();
}
Ejemplo n.º 8
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();
}
Ejemplo n.º 9
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");
}
Ejemplo n.º 10
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();
}
Ejemplo n.º 11
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();
}
/*!
 *  \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.º 13
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.º 14
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();
}
Ejemplo n.º 15
0
/*!
 *  \brief Write switch type operator into an XML stream.
 *  \param ioStreamer XML stream in which the operator is written.
 *  \param inIndent Whether XML output should be indented.
 */
void HPC::SwitchTypeOp::write(PACC::XML::Streamer& ioStreamer, bool inIndent) const
{
	Beagle_StackTraceBeginM();
	ioStreamer.openTag(getName(), inIndent);
	for(OperatorSetMap::const_iterator lIterMap = mOperatorSetMap.begin(); lIterMap != mOperatorSetMap.end(); ++lIterMap){
		ioStreamer.openTag(lIterMap->first, inIndent);
		for(Operator::Bag::const_iterator lIterBag = lIterMap->second.begin(); lIterBag != lIterMap->second.end(); ++lIterBag){
			Operator::Handle lOp = castHandleT<Operator>(*lIterBag);
			lOp->write(ioStreamer, inIndent);
		}
		ioStreamer.closeTag();
	}
	ioStreamer.closeTag();
	Beagle_StackTraceEndM();
}
Ejemplo n.º 16
0
/*!
 *  \brief Write bag of individuals into XML streamer.
 *  \param ioStreamer XML streamer.
 *  \param inIndent Whether XML output should be indented.
 */
void IndividualBag::write(PACC::XML::Streamer& ioStreamer, bool inIndent) const
{
	Beagle_StackTraceBeginM();
	ioStreamer.openTag("IndividualBag", inIndent);
	for(unsigned int i=0; i<size(); ++i) {
		if((*this)[i] == NULL) {
			ioStreamer.openTag("NullHandle");
			ioStreamer.closeTag();
		} else {
			(*this)[i]->write(ioStreamer, inIndent);
		}
	}
	ioStreamer.closeTag();
	Beagle_StackTraceEndM();
}
Ejemplo n.º 17
0
/*!
 *  \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");
}
Ejemplo n.º 18
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();
}
/*!
 *  \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 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");
}
Ejemplo n.º 21
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();
}
Ejemplo n.º 22
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();
}
Ejemplo n.º 23
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();
}
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");
}
Ejemplo n.º 25
0
/*!
 *  \brief Write a primitive sub-tree into a XML streamer.
 *  \param ioStreamer A reference to the XML streamer to write the tree into.
 *  \param inN Index of the actual subtree root node in the vector.
 *  \param inIndent Whether XML output should be indented.
 *  \throw SCHNAPS::Core::AssertException if the subtree size doesn't match.
 */
unsigned int PrimitiveTree::writeSubTree(PACC::XML::Streamer& ioStreamer, unsigned int inN, bool inIndent) const {
	schnaps_StackTraceBeginM();
	schnaps_AssertM(inN < size());
	unsigned int lNumberArguments = (*this)[inN].mPrimitive->getNumberArguments();
	ioStreamer.openTag((*this)[inN].mPrimitive->getName(), inIndent);
	(*this)[inN].mPrimitive->writeContent(ioStreamer, inIndent);
	
	unsigned int lSubTreeSize = 1;
	for (unsigned int i = 0; i < lNumberArguments; ++i) {
		lSubTreeSize += writeSubTree(ioStreamer, (lSubTreeSize+inN), inIndent);
	}
	schnaps_AssertM(lSubTreeSize == (*this)[inN].mSubTreeSize);
	
	ioStreamer.closeTag();
	return lSubTreeSize;
	schnaps_StackTraceEndM("void SCHNAPS::Core::PrimitiveTree::writeSubTree(PACC::XML::Streamer&, bool) const");
}
Ejemplo n.º 26
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();
}
Ejemplo n.º 27
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");
}
Ejemplo n.º 28
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.º 29
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");
}
Ejemplo n.º 30
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");
}