/*!
 *  \brief Read an ES vector from a XML subtree.
 *  \param inIter XML iterator from which the ES vector is read.
 *  \param ioContext Evolutionary context.
 *  \throw IOException If a reading error occured (generally bad file format)!
 */
void GA::ESVector::readWithContext(PACC::XML::ConstIterator inIter, Context& ioContext)
{
	Beagle_StackTraceBeginM();
	if((inIter->getType() != PACC::XML::eData) || (inIter->getValue() != "Genotype")) {
		throw Beagle_IOExceptionNodeM(*inIter, "tag <Genotype> expected!");
	}
	std::string lGenotypeType = inIter->getAttribute("type");
	if((lGenotypeType.empty() == false) && (lGenotypeType != getType())) {
		std::ostringstream lOSS;
		lOSS << "type given '" << lGenotypeType << "' mismatch type of the genotype '";
		lOSS << getType() << "'!";
		throw Beagle_IOExceptionNodeM(*inIter, lOSS.str());
	}

	PACC::XML::ConstIterator lChild = inIter->getFirstChild();
	if((!lChild) || (lChild->getType()!=PACC::XML::eString)) {
		throw Beagle_IOExceptionNodeM(*lChild, "expected content for the ES vector!");
	}

	clear();
	std::istringstream lISS(lChild->getValue());
	do {
		char lC1='\0', lC2='\0', lC3='\0';
		double lValue=DBL_MAX, lStrategy=DBL_MAX;
		lISS >> lC1 >> lValue >> lC2 >> lStrategy >> lC3;
		if((lC1!='(') || (lC2!=',') || (lC3!=')'))
			throw Beagle_IOExceptionNodeM(*lChild, "bad format of ES vector!");
		if((lValue==DBL_MAX) || (lStrategy==DBL_MAX))
			throw Beagle_IOExceptionNodeM(*lChild, "bad format of ES vector!");
		push_back(ESPair(lValue, lStrategy));
	} while(lISS.get()==int('/'));
	Beagle_StackTraceEndM("void GA::ESVector::readWithContext(PACC::XML::ConstIterator,Context&)");
}
/*!
 *  \brief Read a float vector from a XML subtree.
 *  \param inIter XML iterator from which the float vector is read.
 *  \param ioContext Evolutionary context.
 *  \throw Beagle::IOException If a reading error occured (generally bad file format)!
 */
void GA::IntegerVector::readWithContext(PACC::XML::ConstIterator inIter, Context& ioContext)
{
	Beagle_StackTraceBeginM();
	if((inIter->getType() != PACC::XML::eData) || (inIter->getValue() != "Genotype")) {
		throw Beagle_IOExceptionNodeM(*inIter, "tag <Genotype> expected!");
	}
	std::string lGenotypeType = inIter->getAttribute("type");
	if((lGenotypeType.empty() == false) && (lGenotypeType != getType())) {
		std::ostringstream lOSS;
		lOSS << "type given '" << lGenotypeType << "' mismatch type of the genotype '";
		lOSS << getType() << "'!";
		throw Beagle_IOExceptionNodeM(*inIter, lOSS.str());
	}

	PACC::XML::ConstIterator lChild = inIter->getFirstChild();
	if((!lChild) || (lChild->getType()!=PACC::XML::eString))
		throw Beagle_IOExceptionNodeM(*lChild, "expected content for the float vector!");

	clear();
	std::istringstream lISS(lChild->getValue());
	while(lISS.good()) {
		int lValue=INT_MAX;
		lISS >> lValue;
		push_back(lValue);
		if(lISS.good()==false) break;
		int lDelim=lISS.get();
		if((lISS.good()==false) || (lDelim==-1)) break;
	}
	Beagle_StackTraceEndM("void GA::IntegerVector::readWithContext(PACC::XML::ConstIterator,Context&)");
}
Beispiel #3
0
/*!
 * \brief Read object from XML using system.
 * \param inIter XML iterator of input document.
 * \param ioSystem A reference to the system.
 * \throw SCHNAPS::Core::IOException if a wrong tag is encountered.
 */
void PrimitiveTree::readWithSystem(PACC::XML::ConstIterator inIter, System& ioSystem) {
	schnaps_StackTraceBeginM();
	if (inIter) {
		if (inIter->getType() != PACC::XML::eData) {
			throw schnaps_IOExceptionNodeM(*inIter, "tag expected!");
		}
		if (inIter->getValue() != getName()) {
			std::ostringstream lOSS;
			lOSS << "tag <" << getName() << "> expected, but ";
			lOSS << "got tag <" << inIter->getValue() << "> instead!";
			throw schnaps_IOExceptionNodeM(*inIter, lOSS.str());
		}

		// Get size attribute and reserve size accordingly
		std::string lSizeText = inIter->getAttribute("size");
		if (lSizeText.empty() == false) {
			reserve(str2uint(lSizeText));
		}

		PACC::XML::ConstIterator lChild = inIter->getFirstChild();
		if ((!lChild) || (lChild->getType() != PACC::XML::eData)) {
			throw schnaps_IOExceptionNodeM(*lChild, "expected a XML tag for the primitive tree!");
		}
		clear();
		readSubTree(lChild, ioSystem);
	}
	schnaps_StackTraceEndM("void SCHNAPS::Core::PrimitiveTree::readWithSystem(PACC::XML::ConstIterator, SCHNAPS::Core::System&)");
}
Beispiel #4
0
/*!
 *  \brief Read a Factory, obtain selection of default types for the different families.
 *  \param inIter Iterator to the XML node to read the Factory from.
 *  \param ioSystem System to use to read the type selector.
 *  \throw Beagle::IOException If the format is invalid.
 */
void Factory::readWithSystem(PACC::XML::ConstIterator inIter, System& ioSystem)
{
	Beagle_StackTraceBeginM();
	if((inIter->getType()!=PACC::XML::eData) || (inIter->getValue()!="Factory")) {
		throw Beagle_IOExceptionNodeM(*inIter, "tag <Factory> expected!");
	}
	for(PACC::XML::ConstIterator lChild=inIter->getFirstChild(); lChild; ++lChild) {
		if((lChild->getType()==PACC::XML::eData) && (lChild->getValue()=="Concept")) {
			std::string lConceptName = lChild->getAttribute("name");
			if(lConceptName.empty()) {
				throw Beagle_IOExceptionNodeM(*lChild, "no name attribute given for current Concept tag!");
			}
			std::string lTypeName = lChild->getAttribute("type");
			if(lTypeName.empty()) {
				throw Beagle_IOExceptionNodeM(*lChild, "no type attribute given for current Concept tag!");
			}
			Factory::AllocatorMap::const_iterator lIterAllocMap = mAllocatorMap.find(lTypeName);
			if(lIterAllocMap == mAllocatorMap.end()) {
				std::ostringstream lOSS;
				lOSS << "Type named '" << lTypeName;
				lOSS << "' does not exists in the internal allocator map of the Factory; ";
				lOSS << "could not associated to concept '" << lConceptName << "'.";
				throw Beagle_IOExceptionNodeM(*lChild, lOSS.str());
			}
			setConcept(lConceptName, lTypeName);
			Beagle_LogTraceM(
			    ioSystem.getLogger(),
			    std::string("Type associated to concept '")+lConceptName+
			    std::string("' is now '")+lTypeName+std::string("'")
			);
		}
	}
	Beagle_StackTraceEndM();
}
/*!
 *  \brief Read an instruction super set from a Beagle XML stream.
 *  \param inIter XML node used to read the super set from.
 *  \throw Beagle::IOException If size atribute not present.
 */
void LinGP::InstructionSuperSet::read(PACC::XML::ConstIterator inIter)
{
	if((inIter->getType() != PACC::XML::eData) || (inIter->getValue() != "InstructionSuperSet"))
		throw Beagle_IOExceptionNodeM((*inIter), "tag <InstructionSuperSet> expected!");
	unsigned int lPSIndex = 0;
	for(PACC::XML::ConstIterator lChild=inIter->getFirstChild(); lChild; ++lChild) {
		if((lChild->getType()==PACC::XML::eData) && (lChild->getValue()=="InstructionSet")) {
			mInstructionSets[lPSIndex++]->read(lChild);
		}
	}
}
/*!
 *  \brief Read invoker primitive from XML subtree.
 *  \param inIter XML iterator to read the primitive from.
 *  \param ioContext Evolutionary context.
 */
void GP::Invoker::readWithContext(PACC::XML::ConstIterator inIter, GP::Context& ioContext)
{
	Beagle_StackTraceBeginM();
	GP::Primitive::readWithContext(inIter, ioContext);
	std::string lIndexValue = inIter->getAttribute("id");
	if(lIndexValue.empty()==false) mIndex = str2uint(lIndexValue);
	unsigned int lArgsCount = 0;
	for(PACC::XML::ConstIterator lChild=inIter->getFirstChild(); lChild; ++lChild) {
		if(lChild->getType()==PACC::XML::eData) ++lArgsCount;
	}
	setNumberArguments(lArgsCount);
	Beagle_StackTraceEndM("void GP::Invoker::readWithContext(PACC::XML::ConstIterator inIter, GP::Context& ioContext)");
}
/*!
 *  \brief Read the state of the quasi-random generator from a XML subtree.
 *  \param inIter XML iterator to read the mersenne twister randomizer from.
 *  \param ioSystem
 */
void QuasiRandom::readWithSystem(PACC::XML::ConstIterator inIter, System& ioSystem)
{
	Beagle_StackTraceBeginM();
	if((inIter->getType()!=PACC::XML::eData) || (inIter->getValue()!="QuasiRandom"))
		throw Beagle_IOExceptionNodeM(*inIter, "tag <QuasiRandom> expected!");
	PACC::XML::ConstIterator lChild = inIter->getFirstChild();
	if(lChild) {
		if(lChild->getType()!=PACC::XML::eString)
			throw Beagle_IOExceptionNodeM(*lChild, "expected quasi-random state!");
		setState(lChild->getValue());
	} else reset(0);
	Beagle_StackTraceEndM("void QuasiRandom::readWithSystem(PACC::XML::ConstIterator inIter, System& ioSystem)");
}
Beispiel #8
0
/*!
 *  \brief Read an individual bag with a context.
 *  \param inIter XML iterator to read the bag from.
 *  \param ioContext Evolutionary context.
 */
void IndividualBag::readWithContext(PACC::XML::ConstIterator inIter, Context& ioContext)
{
	Beagle_StackTraceBeginM();
	if((inIter->getType()!=PACC::XML::eData) || (inIter->getValue()!="IndividualBag"))
		throw Beagle_IOExceptionNodeM(*inIter, "tag <IndividualBag> expected!");
	for(PACC::XML::ConstIterator lChild=inIter->getFirstChild(); lChild; ++lChild) {
		if(lChild->getType() == PACC::XML::eData) {
			readIndividuals(lChild, ioContext);
			break;
		}
	}
	Beagle_StackTraceEndM();
}
Beispiel #9
0
/*!
 *  \brief Read an individual from an XML node.
 *  \param inIter XML iterator to read the individual from.
 *  \param ioContext Evolutionary context to use to read the individual.
 *  \throw Beagle::IOException If the format is not respected.
 */
void Individual::readWithContext(PACC::XML::ConstIterator inIter, Context& ioContext)
{
	Beagle_StackTraceBeginM();
	if((inIter->getType()!=PACC::XML::eData) || (inIter->getValue()!="Individual")) {
		throw Beagle_IOExceptionNodeM(*inIter, "tag <Individual> expected!");
	}
	// Be sure that the types are corresponding
	const std::string& lIndivType = inIter->getAttribute("type");
	if((lIndivType.empty() == false) && (lIndivType != getType())) {
		std::ostringstream lOSS;
		lOSS << "type given '" << lIndivType << "' mismatch type of the individual '";
		lOSS << getType() << "'!";
		throw Beagle_IOExceptionNodeM(*inIter, lOSS.str());
	}
	// Read members
	readMembers(inIter->getFirstChild(), ioContext);
	// Read fitness
	readFitness(inIter->getFirstChild(), ioContext);
	// Read genotypes
	readGenotypes(inIter->getFirstChild(), ioContext);
	Beagle_StackTraceEndM();
}
Beispiel #10
0
/*!
 *  \brief Read a vivarium from an XML node.
 *  \param inIter XML iterator to read the vivarium from.
 *  \param ioContext Evolutionary context to use to read the vivarium.
 *  \throw Beagle::IOException If the format is not respected.
 */
void Vivarium::readWithContext(PACC::XML::ConstIterator inIter, Context& ioContext)
{
	Beagle_StackTraceBeginM();
	if((inIter->getType()!=PACC::XML::eData) || (inIter->getValue()!="Vivarium")) {
		throw Beagle_IOExceptionNodeM(*inIter, "tag <Vivarium> expected!");
	}
	// Be sure that the types are corresponding
	const std::string& lVivariumType = inIter->getAttribute("type");
	if((lVivariumType.empty()==false) && (lVivariumType!=getType())) {
		std::ostringstream lOSS;
		lOSS << "type given '" << lVivariumType << "' mismatch type of the vivarium '";
		lOSS << getType() << "'!";
		throw Beagle_IOExceptionNodeM(*inIter, lOSS.str());
	}
	// Read members
	readMembers(inIter->getFirstChild(), ioContext);
	// Read population
	for(PACC::XML::ConstIterator lChild=inIter->getFirstChild(); lChild; ++lChild) {
		if((lChild->getType()==PACC::XML::eData) && (lChild->getValue()=="Population")) {
			readPopulation(lChild, ioContext);
		}
	}
	Beagle_StackTraceEndM();
}
Beispiel #11
0
/*!
 *  \brief Read an instruction set from a XML node.
 *  \param inIter XML node to read the instruction set from.
 *  \throw IOException If size atribute not present or if the size mismatch.
 */
void LinGP::InstructionSet::read(PACC::XML::ConstIterator inIter)
{
	if((inIter->getType() != PACC::XML::eData) || (inIter->getValue() != "InstructionSet"))
		throw Beagle_IOExceptionNodeM(*inIter, "tag <InstructionSet> expected!");
	for(PACC::XML::ConstIterator lChild=inIter->getFirstChild(); lChild; ++lChild) {
		if(lChild->getType() == PACC::XML::eData) {
			Instruction::Handle lInstruction = getInstructionByName(lChild->getValue());
			if(lInstruction == NULL) {
				std::ostringstream lOSS;
				lOSS << "Instruction '" << lChild->getValue();
				lOSS << "' is not in the instruction set!";
				throw Beagle_IOExceptionNodeM(*lChild, lOSS.str());
			}
			lInstruction->read(lChild);
		}
	}
}
Beispiel #12
0
/*!
 *  \brief  Read a primitive subtree from a XML subtree.
 *  \param  inIter XML iterator to read primitive tree from.
 *  \param  ioSystem A reference to the system.
 *  \return The size of the subtree read.
 *  \throw  SCHNAPS::Core::IOException if a wrong tag is encountered.
 */
unsigned int PrimitiveTree::readSubTree(PACC::XML::ConstIterator inIter, System& ioSystem) {
	schnaps_StackTraceBeginM();
	if (inIter->getType() != PACC::XML::eData) {
		throw schnaps_IOExceptionNodeM(*inIter, "tag expected!");
	}

	Primitive::Alloc::Handle lPrimitiveAlloc =  castHandleT<Primitive::Alloc>(ioSystem.getFactory().getAllocator(inIter->getValue()));
	if(lPrimitiveAlloc == NULL) {
		std::ostringstream lOSS;
		lOSS << "no primitive named '" <<  inIter->getValue();
		lOSS << "' found in the factory";
		throw schnaps_IOExceptionNodeM(*inIter, lOSS.str());
	}

	Primitive::Handle lPrimitive =  castHandleT<Primitive>(lPrimitiveAlloc->allocate());
	unsigned int lNodeIdx = size();
	push_back(Node(lPrimitive, 0));
	(*this)[lNodeIdx].mPrimitive->readWithSystem(inIter, ioSystem);

	unsigned int lSubTreeSize = 1;
	unsigned int lNbChild = 0;

	for (PACC::XML::ConstIterator lChild = inIter->getFirstChild(); lChild; lChild++) {
		if (lChild->getType() == PACC::XML::eData) {
			lSubTreeSize += readSubTree(lChild, ioSystem);
			lNbChild++;
		}
	}
	if ((*this)[lNodeIdx].mPrimitive->getNumberArguments() == Primitive::eAny) {
		(*this)[lNodeIdx].mPrimitive->setNumberArguments(lNbChild);
	} else {
		if (lNbChild != (*this)[lNodeIdx].mPrimitive->getNumberArguments()) {
			std::ostringstream lOSS;
			lOSS << "number of arguments stated by the primitives (";
			lOSS << (*this)[lNodeIdx].mPrimitive->getNumberArguments();
			lOSS << ") mismatch the number of arguments read for the tree node (";
			lOSS << lNbChild << ")!";
			throw schnaps_IOExceptionNodeM(*inIter, lOSS.str());
		}
	}
	(*this)[lNodeIdx].mSubTreeSize = lSubTreeSize;
	return lSubTreeSize;
	schnaps_StackTraceEndM("void SCHNAPS::Core::PrimitiveTree::readSubTree(PACC::XML::ConstIterator, SCHNAPS::Core::System&)");
}
Beispiel #13
0
/*!
 *  \brief Read a vivarium population from an XML iterator.
 *  \param inIter XML iterator to read the vivarium population from.
 *  \param ioContext Evolutionary context.
 *  \throw Beagle::IOException If the format is not respected.
 */
void Vivarium::readPopulation(PACC::XML::ConstIterator inIter, Context& ioContext)
{
	Beagle_StackTraceBeginM();
	if((inIter->getType()!=PACC::XML::eData) || (inIter->getValue()!="Population")) {
		throw Beagle_IOExceptionNodeM(*inIter, "tag <Population> expected!");
	}
	const Factory& lFactory = ioContext.getSystem().getFactory();
	unsigned int lPrevDemeIndex = ioContext.getDemeIndex();
	Deme::Handle lPrevDemeHandle = ioContext.getDemeHandle();
	clear();
	for(PACC::XML::ConstIterator lIter=inIter->getFirstChild(); lIter; ++lIter) {
		if((lIter->getType()!=PACC::XML::eData) || (lIter->getValue()!="Deme")) continue;
		const std::string& lDemeType = lIter->getAttribute("type");
		Deme::Alloc::Handle lDemeAlloc = NULL;
		if(lDemeType.empty()) {
			Deme::Alloc::Handle lDemeAlloc =
			    castHandleT<Deme::Alloc>(lFactory.getConceptAllocator("Deme"));
			if(lDemeAlloc == NULL) {
				std::ostringstream lOSS;
				lOSS << "Deme object can't be read, ";
				lOSS << "it appears that its type is not given and that there is not ";
				lOSS << "valid concept allocator associated to it!";
				throw Beagle_IOExceptionNodeM(*lIter, lOSS.str());
			}
		} else {
			lDemeAlloc = castHandleT<Deme::Alloc>(lFactory.getAllocator(lDemeType));
			if(lDemeAlloc == NULL) {
				std::ostringstream lOSS;
				lOSS << "Type '" << lDemeType << "' associated to deme object ";
				lOSS << "is not valid!";
				throw Beagle_IOExceptionNodeM(*lIter, lOSS.str());
			}
		}
		Deme::Handle lDeme = castHandleT<Deme>(lDemeAlloc->allocate());
		ioContext.setDemeHandle(lDeme);
		ioContext.setDemeIndex(size());
		push_back(lDeme);
		lDeme->readWithContext(lIter, ioContext);
	}
	ioContext.setDemeHandle(lPrevDemeHandle);
	ioContext.setDemeIndex(lPrevDemeIndex);
	Beagle_StackTraceEndM();
}
Beispiel #14
0
/*!
 *  \brief Read a multiobjective fitness from a XML subtree.
 *  \param inIter XML iterator to use to read the fitness value.
 */
void FitnessMultiObj::read(PACC::XML::ConstIterator inIter)
{
	Beagle_StackTraceBeginM();
	if((inIter->getType()!=PACC::XML::eData) || (inIter->getValue()!="Fitness"))
		throw Beagle_IOExceptionNodeM(*inIter, "tag <Fitness> expected!");

	const std::string& lValid = inIter->getAttribute("valid");
	if(lValid.empty() || (lValid == "yes")) {
	
		// Check type of fitness read
		const std::string& lType = inIter->getAttribute("type");
		if((lType.empty() == false) && (lType != getType())) {
			std::ostringstream lOSS;
			lOSS << "type given '" << lType << "' mismatch type of the fitness '";
			lOSS << getType() << "'!";
			throw Beagle_IOExceptionNodeM(*inIter, lOSS.str());
		}

		// Read objective values
		clear();
		for(PACC::XML::ConstIterator lChild=inIter->getFirstChild(); lChild; ++lChild) {
			if((lChild->getType() != PACC::XML::eData) || (lChild->getValue() != "Obj")) continue;
			PACC::XML::ConstIterator lChild2 = lChild->getFirstChild();
			if(!lChild2) throw Beagle_IOExceptionNodeM(*lChild, "needed a double value in the <Obj> tag!");
			if(lChild2->getType() != PACC::XML::eString)
				throw Beagle_IOExceptionNodeM(*lChild2, "needed a double value in the <Obj> tag!");
			push_back(str2dbl(lChild2->getValue()));
		}
		setValid();
		
	} else if(lValid == "no") {
		clear();
		setInvalid();
	}
	else {
		throw Beagle_IOExceptionNodeM(*inIter, "bad fitness validity value!");
	}
	Beagle_StackTraceEndM();
}
Beispiel #15
0
/*!
 *  \brief Reading a history entry.
 */
void HistoryEntry::read(PACC::XML::ConstIterator inIter)
{
	Beagle_StackTraceBeginM();

	if((inIter->getType()!=PACC::XML::eData) || (inIter->getValue()!="Entry"))
		throw Beagle_IOExceptionNodeM(*inIter, "tag <Entry> expected!");

	std::string lIndividualVarText = inIter->getAttribute("var");
	if(lIndividualVarText.empty())
		throw Beagle_IOExceptionNodeM(*inIter, "attribute 'var' of the tag <Entry> expected!");
	else
		mIndividualVar = str2uint(lIndividualVarText);

	std::string lGenerationText = inIter->getAttribute("generation");
	if (lGenerationText.empty())
		throw Beagle_IOExceptionNodeM(*inIter, "attribute 'generation' of the tag <Entry> expected!");
	else
		mGeneration = str2uint(lGenerationText);

	mParents.clear();
	mActions.clear();
	mOpNames.clear();

	for(PACC::XML::ConstIterator lChild(inIter->getFirstChild()); lChild; ++lChild) {
		if(lChild->getType()==PACC::XML::eData) {
			if(lChild->getValue()=="Parent") {
				unsigned int lHistoryId = str2uint(lChild->getAttribute("id"));
				unsigned int lHistoryVar = str2uint(lChild->getAttribute("var"));
				mParents.push_back(HistoryID(lHistoryId, lHistoryVar));
			} else if(lChild->getValue()=="Operations") {
				mActions.push_back(lChild->getAttribute("action"));
				mOpNames.push_back(lChild->getAttribute("opname"));
			}
		}
	}

	Beagle_StackTraceEndM();
}
Beispiel #16
0
/*!
 *  \brief Read switch case operator from XML subtree and system.
 *  \param inIter XML iterator from which the operator is read.
 *  \param ioSystem Beagle System.
 *  \throw IOException If a reading error occurs.
 */
void HPC::SwitchTypeOp::readWithSystem(PACC::XML::ConstIterator inIter, System& ioSystem)
{
        Beagle_StackTraceBeginM();

        if((inIter->getType()!=PACC::XML::eData) || (inIter->getValue()!=getName())) {
                std::ostringstream lOSS;
                lOSS << "tag <" << getName() << "> expected!" << std::flush;
                throw Beagle_IOExceptionNodeM(*inIter, lOSS.str());
        }
	
	mOperatorSetMap.clear();
        for(PACC::XML::ConstIterator lChild=inIter->getFirstChild(); lChild; ++lChild) {
                if(lChild->getType() == PACC::XML::eData) {
			mOperatorSetMap[lChild->getValue()] = Operator::Bag();
			OperatorSetMap::iterator lIterMap = mOperatorSetMap.find(lChild->getValue());
			for(PACC::XML::ConstIterator lChild2=lChild->getFirstChild(); lChild2; ++lChild2) {
				if(lChild2->getType() == PACC::XML::eData) {
					const std::string& lOpName = lChild2->getValue();
					Operator::Alloc::Handle lOpAlloc =
						castHandleT<Operator::Alloc>(ioSystem.getFactory().getAllocator(lOpName));
					if(lOpAlloc == 0) {
						std::ostringstream lOSS;
						lOSS << "Operator '" << lOpName << "' not found in factory!";
						throw Beagle_RunTimeExceptionM(lOSS.str());
					}
					Operator::Handle lOp = castHandleT<Operator>(lOpAlloc->allocate());
					lOp->setName(lOpName);
					lIterMap->second.push_back(lOp);
					lOp->readWithSystem(lChild2, ioSystem);
				}
			}
		}
        }

        Beagle_StackTraceEndM();
}
/*!
 *  \brief Read a primitive super set from a XML subtree.
 *  \param inIter XML iterator used to read the super set from.
 *  \param ioSystem Evolutionary system.
 *  \throw Beagle::IOException If size atribute not present.
 */
void GP::PrimitiveSuperSet::readWithSystem(PACC::XML::ConstIterator inIter, Beagle::System& ioSystem)
{
	Beagle_StackTraceBeginM();
	if((inIter->getType()!=PACC::XML::eData) || (inIter->getValue()!="GP-PrimitiveSuperSet"))
		throw Beagle_IOExceptionNodeM(*inIter, "tag <GP-PrimitiveSuperSet> expected!");
	const Factory& lFactory = ioSystem.getFactory();
	Context::Alloc::Handle lContextAlloc =
	    castHandleT<Context::Alloc>(lFactory.getConceptAllocator("Context"));
	GP::Context::Handle lGPContext =
	    castHandleT<GP::Context>(lContextAlloc->allocate());
	lGPContext->setSystemHandle(System::Handle(&ioSystem));
	GP::PrimitiveSet::Alloc::Handle lPrimitSetsAlloc =
		castHandleT<GP::PrimitiveSet::Alloc>(lFactory.getConceptAllocator("GP-PrimitiveSet"));
	mPrimitSets.clear();
	for(PACC::XML::ConstIterator lChild=inIter->getFirstChild(); lChild; ++lChild) {
		if((lChild->getType()==PACC::XML::eData) && (lChild->getValue()=="GP-PrimitiveSet")) {
			GP::PrimitiveSet::Handle lPrimitSet =
				castHandleT<GP::PrimitiveSet>(lPrimitSetsAlloc->allocate());
			lPrimitSet->readWithContext(lChild, *lGPContext);
			mPrimitSets.push_back(lPrimitSet);
		}
	}
	Beagle_StackTraceEndM("void GP::PrimitiveSuperSet::readWithSystem(PACC::XML::ConstIterator inIter, Beagle::System& ioSystem)");
}
/*!
 *  \brief Read a MCC's fitness from a XML subtree.
 *  \param inIter XML iterator to use to read the fitness values.
 */
void GP::FitnessMCC::read(PACC::XML::ConstIterator inIter)
{
	Beagle_StackTraceBeginM();
	if((inIter->getType() != PACC::XML::eData) || (inIter->getValue() != "Fitness")) {
		throw Beagle_IOExceptionNodeM(*inIter, "tag <Fitness> expected!");
	}

	std::string lValid = inIter->getAttribute("valid");
	if(lValid.empty() || (lValid == "yes")) {
	
		// Check type of fitness read
		std::string lType = inIter->getAttribute("type");
		if((lType.empty() == false) && (lType != getType())) {
			std::ostringstream lOSS;
			lOSS << "type given '" << lType << "' mismatch type of the fitness '";
			lOSS << getType() << "'!";
			throw Beagle_IOExceptionNodeM(*inIter, lOSS.str());
		}

		// Read values of MCC's fitness
		for(PACC::XML::ConstIterator lChild=inIter->getFirstChild(); lChild; ++lChild) {
			if(lChild->getType() == PACC::XML::eData) {
				if(lChild->getValue() == "MCC") {
					PACC::XML::ConstIterator lChild2 = lChild->getFirstChild();
					if(!lChild2) throw Beagle_IOExceptionNodeM(*lChild, "no MCC fitness value present!");
					if(lChild2->getType() != PACC::XML::eString)
						throw Beagle_IOExceptionNodeM(*lChild2, "no MCC fitness value present!");
					mValue= str2dbl(lChild2->getValue());
				} else if(lChild->getValue() == "TruePositives") {
					PACC::XML::ConstIterator lChild2 = lChild->getFirstChild();
					if(!lChild2) throw Beagle_IOExceptionNodeM(*lChild, "no value for true positives present!");
					if(lChild2->getType() != PACC::XML::eString)
						throw Beagle_IOExceptionNodeM(*lChild2, "no value for true positives present!");
					mTruePositives= str2dbl(lChild2->getValue());
				} else if(lChild->getValue() == "FalsePositives") {
					PACC::XML::ConstIterator lChild2 = lChild->getFirstChild();
					if(!lChild2) throw Beagle_IOExceptionNodeM(*lChild, "no value for false positives present!");
					if(lChild2->getType() != PACC::XML::eString)
						throw Beagle_IOExceptionNodeM(*lChild2, "no value for false positives present!");
					mFalsePositives= str2dbl(lChild2->getValue());
				} else if(lChild->getValue() == "TrueNegatives") {
					PACC::XML::ConstIterator lChild2 = lChild->getFirstChild();
					if(!lChild2) throw Beagle_IOExceptionNodeM(*lChild, "no value for true negatives present!");
					if(lChild2->getType() != PACC::XML::eString)
						throw Beagle_IOExceptionNodeM(*lChild2, "no value for true negatives present!");
					mTrueNegatives= str2dbl(lChild2->getValue());
				} else if(lChild->getValue() == "FalseNegatives") {
					PACC::XML::ConstIterator lChild2 = lChild->getFirstChild();
					if(!lChild2) throw Beagle_IOExceptionNodeM(*lChild, "no value for false negatives present!");
					if(lChild2->getType() != PACC::XML::eString)
						throw Beagle_IOExceptionNodeM(*lChild2, "no value for false negatives present!");
					mFalseNegatives= str2uint(lChild2->getValue());
				} else if(lChild->getValue() == "TruePositivesRel") {
					PACC::XML::ConstIterator lChild2 = lChild->getFirstChild();
					if(!lChild2) throw Beagle_IOExceptionNodeM(*lChild, "no value for true positives rel present!");
					if(lChild2->getType() != PACC::XML::eString)
						throw Beagle_IOExceptionNodeM(*lChild2, "no value for true positives rel present!");
					mTruePositivesRel= str2dbl(lChild2->getValue());
				} else if(lChild->getValue() == "FalsePositivesRel") {
					PACC::XML::ConstIterator lChild2 = lChild->getFirstChild();
					if(!lChild2) throw Beagle_IOExceptionNodeM(*lChild, "no value for false positives rel present!");
					if(lChild2->getType() != PACC::XML::eString)
						throw Beagle_IOExceptionNodeM(*lChild2, "no value for false positives rel present!");
					mFalsePositivesRel= str2dbl(lChild2->getValue());
				} else if(lChild->getValue() == "TrueNegativesRel") {
					PACC::XML::ConstIterator lChild2 = lChild->getFirstChild();
					if(!lChild2) throw Beagle_IOExceptionNodeM(*lChild, "no value for true negatives rel present!");
					if(lChild2->getType() != PACC::XML::eString)
						throw Beagle_IOExceptionNodeM(*lChild2, "no value for true negatives rel present!");
					mTrueNegativesRel= str2dbl(lChild2->getValue());
				} else if(lChild->getValue() == "FalseNegativesRel") {
					PACC::XML::ConstIterator lChild2 = lChild->getFirstChild();
					if(!lChild2) throw Beagle_IOExceptionNodeM(*lChild, "no value for false negatives Rel present!");
					if(lChild2->getType() != PACC::XML::eString)
						throw Beagle_IOExceptionNodeM(*lChild2, "no value for false negatives Rel present!");
					mFalseNegativesRel= str2uint(lChild2->getValue());
				}
			}
		}

	} else if(lValid == "no") {
		setInvalid();
	}
	else {
		throw Beagle_IOExceptionNodeM(*inIter, "bad fitness validity value!");
	}

	Beagle_StackTraceEndM("void GP::FitnessMCC::read(PACC::XML::ConstIterator inIter)");
}
void BGFitness::read(PACC::XML::ConstIterator inNode) {	
	//	Beagle_StackTraceBeginM();
	
	if((inNode->getType()!=PACC::XML::eData) || (inNode->getValue()!="Fitness"))
		throw Beagle_IOExceptionNodeM(*inNode, "tag <Fitness> expected!");
	
	std::string lValid = inNode->getAttribute("valid").c_str();
	
	if(lValid.empty() || (lValid == "yes")) {
		std::string lType = inNode->getAttribute("type").c_str();
		if(lType != "LogFitness")
			throw Beagle_IOExceptionNodeM((*inNode), "fitness type mismatch!");
		
		mUncompressedSize.clear();
		mVariableData.clear();
		mVariableName.clear();
		mStateMatrices.clear();
		
		for(PACC::XML::ConstIterator lChild=inNode->getFirstChild(); lChild; lChild=lChild->getNextSibling()) {
			if(lChild->getValue() == "Obj") {
				PACC::XML::ConstIterator lChild2 = lChild->getFirstChild();
				if(!lChild2) throw Beagle_IOExceptionNodeM(*inNode, "no fitness value present!");
				if(lChild2->getType() != PACC::XML::eString)
					throw Beagle_IOExceptionNodeM(*inNode, "no fitness value present!");

				mFitness = str2dbl(lChild2->getValue().c_str());

			}
			if(lChild->getValue() == "OriObj") {
				PACC::XML::ConstIterator lChild2 = lChild->getFirstChild();
				if(!lChild2) throw Beagle_IOExceptionNodeM(*inNode, "no original fitness value present!");
				if(lChild2->getType() != PACC::XML::eString)
					throw Beagle_IOExceptionNodeM(*inNode, "no original fitness value present!");
				
				mOriginalFitness = str2dbl(lChild2->getValue().c_str());
				
			}
			if(lChild->getValue() == "StateMatrices") {
				for(PACC::XML::ConstIterator lChild2=lChild->getFirstChild(); lChild2; lChild2=lChild2->getNextSibling()) {
					PACC::Matrix lMatrix;
					lMatrix.read(lChild2);
					//MatrixInterface lInterface;
//					lInterface.read(lMatrix,*lChild2);
					mStateMatrices.push_back(lMatrix);
				}
			}
			else if(lChild->getValue() == "Data") {
				mVariableName.push_back(lChild->getAttribute("Name"));
				mUncompressedSize.push_back( str2uint(lChild->getAttribute("usize")) );
				if(str2uint(lChild->getAttribute("usize")) != 0) {
					PACC::XML::ConstIterator lChild2 = lChild->getFirstChild();
					if(!lChild2) {
						throw Beagle_IOExceptionNodeM((*lChild), "needed a CDATA value in the <Path> tag!");
					}
					if(lChild2->getType() != PACC::XML::eString) {
						throw Beagle_IOExceptionNodeM((*lChild2), "needed a string value in the <Path> tag!");
					}
					mVariableData.push_back(lChild2->getValue());
				} else {
					mVariableData.push_back("");
				}
			}
			else if(lChild->getValue() == "DataSet") {
				unsigned int lID = str2uint(lChild->getAttribute("ID"));
				double lFitness = 0;
				for(PACC::XML::ConstIterator lChild2=lChild->getFirstChild(); lChild2; lChild2=lChild2->getNextSibling()) {
					if(lChild2->getValue() == "Obj") {
						PACC::XML::ConstIterator lChild3 = lChild2->getFirstChild();
						if(!lChild3) throw Beagle_IOExceptionNodeM(*inNode, "no fitness value present!");
						if(lChild3->getType() != PACC::XML::eString)
							throw Beagle_IOExceptionNodeM(*inNode, "no fitness value present!");
						lFitness = str2dbl(lChild3->getValue());
					}
					else if(lChild2->getValue() == "Data") {
						mVariableName.push_back(lChild2->getAttribute("Name"));
						mVariableDataSet.push_back(lID);
						mUncompressedSize.push_back( str2uint(lChild2->getAttribute("usize")) );
						if(str2uint(lChild2->getAttribute("usize")) != 0) {
							PACC::XML::ConstIterator lChild3 = lChild2->getFirstChild();
							if(!lChild3) {
								throw Beagle_IOExceptionNodeM((*lChild2), "needed a CDATA value in the <Path> tag!");
							}
							if(lChild3->getType() != PACC::XML::eString) {
								throw Beagle_IOExceptionNodeM((*lChild3), "needed a string value in the <Path> tag!");
							}
							mVariableData.push_back(lChild3->getValue());
						} else {
							mVariableData.push_back("");
						}
					}
				}
				
				mDataSet[lID] = lFitness;
			}
			else if(lChild->getValue() == "Info") {
				for(PACC::XML::ConstIterator lChild2=lChild->getFirstChild(); lChild2; lChild2=lChild2->getNextSibling()) {
					std::string lInfoName = lChild2->getValue();
					PACC::XML::ConstIterator lChild3 = lChild2->getFirstChild();
					if(!lChild3) throw Beagle_IOExceptionNodeM(*inNode, "info data present!");
					if(lChild3->getType() != PACC::XML::eString)
						throw Beagle_IOExceptionNodeM(*inNode, "info data present!");
					std::string lInfoData = lChild3->getValue();
					
					mInfo[lInfoName] = lInfoData;
				}
			}
			else if(lChild->getValue() == "BondGraph") {
				mBondGraph = new GrowingHybridBondGraph;
				mBondGraph->read(lChild);
			}	
			else if(lChild->getValue() == "SimplifiedBondGraph") {
				PACC::XML::ConstIterator lChild2 = lChild->getFirstChild();
				if(!lChild2) throw Beagle_IOExceptionNodeM(*inNode, "No simplified bond graph present!");
				if(lChild2->getValue() == "BondGraph") {
					mSimplifiedBondGraph = new GrowingHybridBondGraph;
					mSimplifiedBondGraph->read(lChild2);
				}
			}
			else //Ignore anything else
				continue;
			
		}
		setValid();
	}
	else if(lValid == "no") setInvalid();
	else throw Beagle_IOExceptionNodeM((*inNode), "bad fitness validity value!");
	//	Beagle_StackTraceEndM("void LogFitness::read(Beagle::XMLNode::Handle inNode)");
	
}
void TreeSTag::readWithContext(PACC::XML::ConstIterator inIter, Beagle::Context& ioContext){
	Beagle_StackTraceBeginM();
	GP::Context& lGPContext = castObjectT<GP::Context&>(ioContext);
	
	if((inIter->getType()!=PACC::XML::eData) || (inIter->getValue()!="Genotype"))
		throw Beagle_IOExceptionNodeM(*inIter, "tag <Genotype> expected!");
	
	std::string lType = inIter->getAttribute("type").c_str();
	if(lType.empty())
		throw Beagle_IOExceptionNodeM(*inIter, "GP tree type of the genotype is not present!");
	if(lType != "gptreetag")
		throw Beagle_IOExceptionNodeM(*inIter, std::string("type of genotype mismatch, expected ")
									  +std::string("\"gptreetag\" but read \"")+lType+std::string("\" instead!"));
	
	//Get structure id
	std::string lStructureID = inIter->getAttribute("structureid").c_str();
	mStructureID = str2uint(lStructureID);
	
	// Get primitive set index
	std::string lPrimitiveSetIndexText = inIter->getAttribute("primitiveSetIndex").c_str();
	if(lPrimitiveSetIndexText.empty()) {
		// No primitive set index was specified.  This must be an old
		// tree.  Assume index is equal to tree's index
		unsigned int lGenotypeIndex = ioContext.getGenotypeIndex();
		if(lGenotypeIndex >= lGPContext.getSystem().getPrimitiveSuperSet().size()) {
			throw Beagle_RunTimeExceptionM(std::string("In GP::Tree::readWithContext(): The ")+
										   std::string("'primitiveSetIndex' attribute was missing from an individual's genotype. ")+
										   std::string("It would normally be assumed that such a tree was to be mapped to the ")+
										   std::string("primitive set of the same index as the genotype. In this case that would ")+
										   std::string("result in an incorrect mapping because there are not enough primitive sets ")+
										   std::string("in the System. Perhaps this individual was not intended to be read with the ")+
										   std::string("current set of primitive sets?"));
		}
		setPrimitiveSetIndex(lGenotypeIndex);
	}
	else {
		// primitiveSetIndex is a valid attribute.
		unsigned int lPrimitiveSetIndex = str2uint(lPrimitiveSetIndexText);
		if(lPrimitiveSetIndex >= lGPContext.getSystem().getPrimitiveSuperSet().size()) {
			std::string lMessage = std::string("In GP::Tree::readWithContext(): The 'primitiveSetIndex' ")+
			std::string("attribute contained the value '") + lPrimitiveSetIndexText + 
			std::string("' which was read as the number '") + uint2str(lPrimitiveSetIndex) + 
			std::string("'. This value is incorrect as there are not enough primitive sets in the ")+
			std::string("System. Perhaps this individual was not intended to be read with the current ")+
			std::string("set of primitive sets?");
			throw Beagle_RunTimeExceptionM(lMessage);
		}
		setPrimitiveSetIndex(lPrimitiveSetIndex);
	}
	
	// Get numberArguments attribute
	std::string lNumberArgumentsText = inIter->getAttribute("numberArguments").c_str();
	if(lNumberArgumentsText.empty()) {
		// numberArguments attribute wasn't defined.  This must be an old
		// tree.  Assume the number of arguments is zero.
		setNumberArguments(0);
	}
	else {
		// numberArguments is a valid attribute.
		setNumberArguments(str2uint(lNumberArgumentsText));
	}
	
	// Get size attribute and reserve size accordingly
	std::string lSizeText = inIter->getAttribute("size").c_str();
	if(lSizeText.empty()==false) reserve(str2uint(lSizeText));
	
	PACC::XML::ConstIterator lChild = inIter->getFirstChild();
	if((!lChild) || (lChild->getType()!=PACC::XML::eData))
		throw Beagle_IOExceptionNodeM(*lChild, "expected a XML tag for the GP tree!");
	
	clear();
	readSubTree(lChild, lGPContext);
	
	//Read BondGraph if any
	const PACC::XML::Node* lParent = inIter->getParent();
	
	PACC::XML::ConstFinder lIndivFinder = PACC::XML::ConstIterator(lParent);
	PACC::XML::ConstIterator lBGTag = lIndivFinder.find("//BondGraph");
	if(!lBGTag) { 
		return;
	}
	
//	mBondGraph = new GrowingHybridBondGraph;
//	mBondGraph->read(lBGTag);	
	
	Beagle_StackTraceEndM("void GP::Tree::readWithContext(PACC::XML::ConstIterator inIter, Beagle::Context& ioContext)");
}
/*!
 *  \brief Read stats from a XML subtree.
 *  \param inIter XML iterator to read the stats from.
 *  \param ioContext Evolutionary context to use to read the hall-of-fame.
 */
void Stats::readWithContext(PACC::XML::ConstIterator inIter, Context& ioContext)
{
	Beagle_StackTraceBeginM();
	if((inIter->getType()!=PACC::XML::eData) || (inIter->getValue()!="Stats"))
		throw Beagle_IOExceptionNodeM(*inIter, "tag <Stats> expected!");

	// Be sure that the types are corresponding
	std::string lIndivType = inIter->getAttribute("type");
	if((lIndivType.empty()==false) && (lIndivType!=getType())) {
		std::ostringstream lOSS;
		lOSS << "type given '" << lIndivType << "' mismatch type of the statistics '";
		lOSS << getType() << "'!";
		throw Beagle_IOExceptionNodeM(*inIter, lOSS.str());
	}

	std::string lValid = inIter->getAttribute("valid");
	clear();
	mItemMap.clear();
	if(lValid.empty() || (lValid == "yes")) {
		mValid = true;
		mID = inIter->getAttribute("id");

		std::string lGenerationStr = inIter->getAttribute("generation");
		if(lGenerationStr.empty() == false) mGeneration = str2uint(lGenerationStr);
		else mGeneration = 0;

		std::string lPopSizeStr = inIter->getAttribute("popsize");
		if(lPopSizeStr.empty() == false) mPopSize = str2uint(lPopSizeStr);
		else mPopSize = 0;

		unsigned int lSize=0;
		for(PACC::XML::ConstIterator lChild=inIter->getFirstChild(); lChild; ++lChild) {
			if((lChild->getType()==PACC::XML::eData) && (lChild->getValue()=="Measure")) ++lSize;
		}
		resize(lSize);
		unsigned int lIndexMeasure=0;
		for(PACC::XML::ConstIterator lChild=inIter->getFirstChild(); lChild; ++lChild) {
			if(lChild->getType() == PACC::XML::eData) {
				if(lChild->getValue() == "Item") {
					std::string lKey = lChild->getAttribute("key");
					if(lKey.empty()) {
						std::ostringstream lOSS;
						lOSS << "expected a key attribute while reading a statistics item!";
						throw Beagle_IOExceptionNodeM(*lChild, lOSS.str());
					}
					PACC::XML::ConstIterator lChild2 = lChild->getFirstChild();
					if(!lChild2) {
						std::ostringstream lOSS;
						lOSS << "expected an item value while reading a statistics item!";
						throw Beagle_IOExceptionNodeM(*lChild, lOSS.str());
					}
					if(lChild2->getType() != PACC::XML::eString) {
						std::ostringstream lOSS;
						lOSS << "expected an item value while reading a statistics item!";
						throw Beagle_IOExceptionNodeM(*lChild2, lOSS.str());
					}
					mItemMap.insert(std::make_pair(lKey,str2dbl(lChild2->getValue())));
				}
				else if(lChild->getValue() == "Measure") {
					(*this)[lIndexMeasure].mID  = lChild->getAttribute("id");
					(*this)[lIndexMeasure].mAvg = 0.0;
					(*this)[lIndexMeasure].mStd = 0.0;
					(*this)[lIndexMeasure].mMax = 0.0;
					(*this)[lIndexMeasure].mMin = 0.0;
					for(PACC::XML::ConstIterator lChild2=lChild->getFirstChild(); lChild2; ++lChild2) {
						if(lChild2->getType() == PACC::XML::eData) {
							if(lChild2->getValue() == "Avg") {
								PACC::XML::ConstIterator lChild3 = lChild2->getFirstChild();
								if(lChild3->getType() != PACC::XML::eString) continue;
								else (*this)[lIndexMeasure].mAvg = str2dbl(lChild3->getValue());
							} else if(lChild2->getValue() == "Std") {
								PACC::XML::ConstIterator lChild3 = lChild2->getFirstChild();
								if(lChild3->getType() != PACC::XML::eString) continue;
								else (*this)[lIndexMeasure].mStd = str2dbl(lChild3->getValue());
							} else if(lChild2->getValue() == "Max") {
								PACC::XML::ConstIterator lChild3 = lChild2->getFirstChild();
								if(lChild3->getType() != PACC::XML::eString) continue;
								else (*this)[lIndexMeasure].mMax = str2dbl(lChild3->getValue());
							} else if(lChild2->getValue() == "Min") {
								PACC::XML::ConstIterator lChild3 = lChild2->getFirstChild();
								if(lChild3->getType() != PACC::XML::eString) continue;
								else (*this)[lIndexMeasure].mMin = str2dbl(lChild3->getValue());
							}
						}
					}
					++lIndexMeasure;
				}
			}
		}
	} else if(lValid == "no") mValid = false;
	else throw Beagle_IOExceptionNodeM((*inIter), "bad stats validity value!");
	Beagle_StackTraceEndM("void Stats::readWithContext(PACC::XML::ConstIterator,Context&)");
}
/*!
 *  \brief Read a Koza's fitness from a XML subtree.
 *  \param inIter XML iterator to use to read the fitness values.
 */
void GP::FitnessKoza::read(PACC::XML::ConstIterator inIter)
{
	Beagle_StackTraceBeginM();
	if((inIter->getType() != PACC::XML::eData) || (inIter->getValue() != "Fitness")) {
		throw Beagle_IOExceptionNodeM(*inIter, "tag <Fitness> expected!");
	}

	std::string lValid = inIter->getAttribute("valid");
	if(lValid.empty() || (lValid == "yes")) {
	
		// Check type of fitness read
		std::string lType = inIter->getAttribute("type");
		if((lType.empty() == false) && (lType != getType())) {
			std::ostringstream lOSS;
			lOSS << "type given '" << lType << "' mismatch type of the fitness '";
			lOSS << getType() << "'!";
			throw Beagle_IOExceptionNodeM(*inIter, lOSS.str());
		}

		// Read values of Koza's fitness
		for(PACC::XML::ConstIterator lChild=inIter->getFirstChild(); lChild; ++lChild) {
			if(lChild->getType() == PACC::XML::eData) {
				if(lChild->getValue() == "Normalized") {
					PACC::XML::ConstIterator lChild2 = lChild->getFirstChild();
					if(!lChild2) throw Beagle_IOExceptionNodeM(*lChild, "no normalized fitness value present!");
					if(lChild2->getType() != PACC::XML::eString)
						throw Beagle_IOExceptionNodeM(*lChild2, "no normalized fitness value present!");
					mValue = str2dbl(lChild2->getValue());
				} else if(lChild->getValue() == "Adjusted") {
					PACC::XML::ConstIterator lChild2 = lChild->getFirstChild();
					if(!lChild2) throw Beagle_IOExceptionNodeM(*lChild, "no adjusted fitness value present!");
					if(lChild2->getType() != PACC::XML::eString)
						throw Beagle_IOExceptionNodeM(*lChild2, "no adjusted fitness value present!");
					mAdjustedFitness = str2dbl(lChild2->getValue());
				} else if(lChild->getValue() == "Standardized") {
					PACC::XML::ConstIterator lChild2 = lChild->getFirstChild();
					if(!lChild2) throw Beagle_IOExceptionNodeM(*lChild, "no standardized fitness value present!");
					if(lChild2->getType() != PACC::XML::eString)
						throw Beagle_IOExceptionNodeM(*lChild2, "no standardized fitness value present!");
					mStandardizedFitness = str2dbl(lChild2->getValue());
				} else if(lChild->getValue() == "Raw") {
					PACC::XML::ConstIterator lChild2 = lChild->getFirstChild();
					if(!lChild2) throw Beagle_IOExceptionNodeM(*lChild, "no raw fitness value present!");
					if(lChild2->getType() != PACC::XML::eString)
						throw Beagle_IOExceptionNodeM(*lChild2, "no raw fitness value present!");
					mRawFitness = str2dbl(lChild2->getValue());
				} else if(lChild->getValue() == "Hits") {
					PACC::XML::ConstIterator lChild2 = lChild->getFirstChild();
					if(!lChild2) throw Beagle_IOExceptionNodeM(*lChild, "no hits value present!");
					if(lChild2->getType() != PACC::XML::eString)
						throw Beagle_IOExceptionNodeM(*lChild2, "no hits value present!");
					mHits = str2uint(lChild2->getValue());
				}
			}
		}

	} else if(lValid == "no") {
		setInvalid();
	}
	else {
		throw Beagle_IOExceptionNodeM(*inIter, "bad fitness validity value!");
	}

	Beagle_StackTraceEndM("void GP::FitnessKoza::read(PACC::XML::ConstIterator inIter)");
}