コード例 #1
0
    void AtariFTNeatExperiment::convertIndividual(shared_ptr<GeneticIndividual> FTNEAT_individual,
                                                  NEAT::LayeredSubstrate<float>* HyperNEAT_substrate)
                                                  
    {
        NEAT::FastLayeredNetwork<float>* HyperNEAT_network = HyperNEAT_substrate->getNetwork();

        // [Links] Input --> Processing 
        for (int i=0; i<=numObjClasses; ++i) {
            for (int x=0; x<substrate_width; x++) {
                for (int y=0; y<substrate_height; y++) {
                    Node fromNode(x, y, i);
                    int xmod = substrate_width*i+x; 
                    string sourceString(toString(xmod) + string("/") + toString(y) + string("/") + toString("0"));
                    GeneticNodeGene* sourceNode = FTNEAT_individual->getNode(sourceString);
                    // Processing Layer
                    for (int toY=0; toY<substrate_height; toY++) {
                        for (int toX=0; toX<substrate_width; toX++) {
                            Node toNode(toX, toY, numObjClasses+1);
                            string targetString(toString(toX) + string("/") + toString(toY) +
                                                string("/") + toString("1"));
                            GeneticNodeGene* targetNode = FTNEAT_individual->getNode(targetString);

                            float linkWeight = HyperNEAT_network->getLink(fromNode,toNode);

                            GeneticLinkGene* FTNEAT_link;
                            FTNEAT_link = FTNEAT_individual->getLink(sourceNode->getID(), targetNode->getID());
                            FTNEAT_link->setWeight(double(linkWeight));
                        }
                    }
                }
            }
        }

        // [Links] Processing --> Output
        for (int y=0; y<substrate_height; y++) {
            for (int x=0; x<substrate_width; x++) {
                Node fromNode(x, y, numObjClasses+1);
                string sourceString(toString(x) + string("/") + toString(y) + string("/") + toString("1"));
                GeneticNodeGene* sourceNode = FTNEAT_individual->getNode(sourceString);

                // Output Layer
                for (int i=0; i<numActions; i++) {
                    Node toNode(i, 0, numObjClasses+2);

                    string targetString(toString(i) + string("/") + toString("0") + string("/") + toString("2"));
                    GeneticNodeGene* targetNode = FTNEAT_individual->getNode(targetString);

                    float linkWeight = HyperNEAT_network->getLink(fromNode,toNode);

                    GeneticLinkGene* FTNEAT_link;
                    FTNEAT_link = FTNEAT_individual->getLink(sourceNode->getID(), targetNode->getID());
                    FTNEAT_link->setWeight(double(linkWeight));
                }
            }
        }
    }
コード例 #2
0
bool SoftUpdatePrefsXMLSerializer::unserialize( TiXmlNode* node )
{
	bool result = true;

	if (node) 
	{
		_prefs.setVersionToIgnore ( 	    fromNode( node, "versionToIgnore"   ) );
		_prefs.setDateLastIgnored(	toDate( fromNode( node, "dateLastIgnored" ) ) );
		_prefs.setAutoCheck       ( toBool( fromNode( node, "autoCheck"		  ) ) );
	}

	return result;
}
コード例 #3
0
bool QueryResultXMLSerializer::unserializeQuery( TiXmlNode* queryNode )
{
	bool result = true;

	if (queryNode) 
	{
		_queryResult.setQuestion   (		   fromNode( queryNode, "question"    ) );
		_queryResult.setFilter     (		   fromNode( queryNode, "filterField" ) );
		_queryResult.setFilterValue(		   fromNode( queryNode, "filterValue" ) );
//		_queryResult.setQueryTime  ( toDouble( fromNode( queryNode, "queryTook" ) ) );
		_queryResult.setQueryTime  ( toDouble( fromNode( queryNode, "T"			) ) );
	}

	return result;
}
コード例 #4
0
bool QueryResultXMLSerializer::unserializeResponse( TiXmlNode* responseNode )
{
	bool result = true;

	if ( responseNode )
	{
		_queryResult.setResponse( toInt( fromNode( responseNode ) ) );
	}

	return result;
}
コード例 #5
0
bool QueryResultXMLSerializer::unserializeStatus( TiXmlNode* statusNode )
{
	bool result = true;

	if ( statusNode )
	{
		std::string value = fromNode( statusNode );

		_queryResult.setSucceeded( value == "success" );
	}

	return result;
}
コード例 #6
0
QString AnchorHandleItem::toolTipString() const
{
    QString templateString("<p>Anchor Handle</p><p>%1</p><p>%2</p>");
    QmlItemNode fromNode(anchorController().formEditorItem()->qmlItemNode());
    QString fromString(QString("%3: %1(%2)").arg(fromNode.simplifiedTypeName(), fromNode.id(), anchorLineToString(sourceAnchorLine())));

    AnchorLine toAnchorLine(targetAnchorLine());
    QmlItemNode toNode(toAnchorLine.qmlItemNode());
    QString toString;
    if (toNode.isValid())
        toString = QString("%3: %1(%2)").arg(toNode.simplifiedTypeName(), toNode.id(), anchorLineToString(toAnchorLine.type()));

    return templateString.arg(fromString).arg(toString);
}
コード例 #7
0
ファイル: StrokeStreamer.cpp プロジェクト: aserkan/cPlusPlus
	BitmapGraphics::HStroke StrokeStreamer::fromXml(std::stringstream& xml)
	{
		Node node = Streamer::fromXml(xml);
		return fromNode(node);
	}
コード例 #8
0
ファイル: link.cpp プロジェクト: Atronax/Planndo
void Link::trackNodes()
{
    setLine(QLineF(fromNode()->pos(), toNode()->pos()));
    update();
}
コード例 #9
0
ファイル: link.cpp プロジェクト: Atronax/Planndo
Link::~Link()
{
    fromNode()->removeLink(this);
    toNode()->removeLink(this);
}