1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
|
/*
* OptimizerRun.cpp - TaskJuggler
*
* Copyright (c) 2001, 2002, 2003, 2004 by Chris Schlaeger <cs@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* $Id: OptimizerRun.cpp 1259 2006-01-31 12:04:00Z cs $
*/
#include "OptimizerRun.h"
#include "Optimizer.h"
#include "DecisionNode.h"
#include "debug.h"
OptimizerRun::OptimizerRun(Optimizer* o) : optimizer(o)
{
currentNode = optimizer->getDecisionTreeRoot();
}
OptimizerRun::~OptimizerRun()
{
}
bool
OptimizerRun::checkArc(const QString& tag)
{
if (DEBUGOP(10))
qDebug("Checking arg %s of node %s", tag.latin1(),
currentNode->getTag().latin1());
return currentNode->checkArc(tag);
}
bool
OptimizerRun::followArc(const QString& tag)
{
if (DEBUGOP(5))
qDebug("Following arg %s of node %s", tag.latin1(),
currentNode->getTag().latin1());
DecisionNode* dn = currentNode->followArc(tag);
if (dn)
{
currentNode = dn;
return TRUE;
}
return FALSE;
}
void
OptimizerRun::terminate(double rating)
{
currentNode->terminateBranch(rating, optimizer->getMinimize());
if (DEBUGOP(5))
qDebug("Run was rated %f", rating);
}
|