Ejemplo n.º 1
0
void Expectations::generateExp()
{
    setStrategy(new Algo(UTManager::instance().student(), exp_));
    exp_->setSemesters(autocompletion_->run());
    createExpPanel();

}
Ejemplo n.º 2
0
void
StrategyChoiceManager::onValidatedStrategyChoiceRequest(const shared_ptr<const Interest>& request)
{
  static const Name::Component VERB_SET("set");
  static const Name::Component VERB_UNSET("unset");

  const Name& command = request->getName();
  const Name::Component& parameterComponent = command[COMMAND_PREFIX.size() + 1];

  ControlParameters parameters;
  if (!extractParameters(parameterComponent, parameters))
    {
      sendResponse(command, 400, "Malformed command");
      return;
    }

  const Name::Component& verb = command[COMMAND_PREFIX.size()];
  ControlResponse response;
  if (verb == VERB_SET)
    {
      setStrategy(parameters, response);
    }
  else if (verb == VERB_UNSET)
    {
      unsetStrategy(parameters, response);
    }
  else
    {
      NFD_LOG_DEBUG("command result: unsupported verb: " << verb);
      setResponse(response, 501, "Unsupported command");
    }

  sendResponse(command, response);
}
Ejemplo n.º 3
0
DTimerStrategy::DTimerStrategy(TimerStrategyMode mode,
                               const std::vector<int> &date,
                               const String &startTime,
                               const String &endTime,
                               unsigned int interval) {
    setStrategy(mode, date, startTime, endTime, interval);
}
	OverhangTerrainPagedWorldSection::OverhangTerrainPagedWorldSection( const String& name, PagedWorld* parent, SceneManager* sm )
		: PagedWorldSection(name, parent, sm), 
			_pOhGrp(NULL), 
			_pPageStrategy(static_cast< Grid2DPageStrategy * > (parent->getManager()->getStrategy("Grid2D")))
	{
		setStrategy(_pPageStrategy);
	}
Ejemplo n.º 5
0
Archivo: fib.cpp Proyecto: cawka/NLSR
void
Fib::onSetStrategyFailure(const ndn::nfd::ControlResponse& response,
                          const ndn::nfd::ControlParameters& parameters,
                          uint32_t count,
                          const std::string& message)
{
  NLSR_LOG_DEBUG(message << ": " << parameters.getStrategy() << " "
            << "for name: " << parameters.getName());
  if (count < 3) {
    setStrategy(parameters.getName(), parameters.getStrategy().toUri(),count+1);
  }
}
Ejemplo n.º 6
0
// constructor
StrategyManager::StrategyManager() 
	: firstAttackSent(false)
	, currentStrategy(0)
	, openingStrategy(0)
	, selfRace(BWAPI::Broodwar->self()->getRace())
	, enemyRace(BWAPI::Broodwar->enemy()->getRace())
	, bayesianNet(NULL)
	, state(OPENING)
	, doStateUpdateNow(false)
	, timeSinceLastStateUpdate(0)
	, lastBnUpdate(0)
{
	loadBayesianNetwork();
	addStrategies();
	setStrategy();
}
	void DifferentialEvolution::adaptParameters() {
		const Real F_l = 0.1;
		const Real F_u = 0.9;
		const Real tau_1 = 0.1;
		const Real tau_2 = 0.1;

		const Real r_1 = uniformRng_.nextReal();
		const Real r_2 = uniformRng_.nextReal();
		const Real r_3 = uniformRng_.nextReal();
		const Real r_4 = uniformRng_.nextReal();

		F_  = r_2 < tau_1 ? F_l + r_1*F_u : F_;
		CR_ = r_4 < tau_2 ? r_3 : CR_;

		setStrategy();
	}
    //---------------------------------------------------------------------
    TerrainPagedWorldSection::TerrainPagedWorldSection(const String& name, PagedWorld* parent, SceneManager* sm)
        : PagedWorldSection(name, parent, sm)
        , mTerrainGroup(0)
        , mTerrainDefiner(0)
        , mHasRunningTasks(false)
        , mLoadingIntervalMs(900)
    {
        // we always use a grid strategy
        setStrategy(parent->getManager()->getStrategy("Grid2D"));

        WorkQueue* wq = Root::getSingleton().getWorkQueue();
        mWorkQueueChannel = wq->getChannel("Ogre/TerrainPagedWorldSection");
        wq->addRequestHandler(mWorkQueueChannel, this);
        wq->addResponseHandler(mWorkQueueChannel, this);

        mNextLoadingTime = Root::getSingletonPtr()->getTimer()->getMilliseconds();
    }
Ejemplo n.º 9
0
//---------------------------------------------------------------------
bool PagedWorldSection::load(StreamSerialiser& ser)
{
    if (!ser.readChunkBegin(CHUNK_ID, CHUNK_VERSION, "PagedWorldSection"))
        return false;

    // Name
    ser.read(&mName);
    // AABB
    ser.read(&mAABB);
    // SceneManager type
    String smType, smInstanceName;
    SceneManager* sm = 0;
    ser.read(&smType);
    ser.read(&smInstanceName);
    Root& root = Root::getSingleton();
    if (root.hasSceneManager(smInstanceName))
        sm = root.getSceneManager(smInstanceName);
    else
        sm = root.createSceneManager(smType, smInstanceName);
    setSceneManager(sm);
    // Page Strategy Name
    String stratname;
    ser.read(&stratname);
    setStrategy(stratname);
    // Page Strategy Data
    bool strategyDataOk = mStrategyData->load(ser);
    if (!strategyDataOk)
        LogManager::getSingleton().stream() << "Error: PageStrategyData for section '"
                                            << mName << "' was not loaded correctly, check file contents";

    /// Load any data specific to a subtype of this class
    loadSubtypeData(ser);

    ser.readChunkEnd(CHUNK_ID);

    return true;

}
Ejemplo n.º 10
0
void testSolver(void)
{
   Coor c;
   int numMoves, numGroupsLeft, totalMoves;
   clock_t begin, end;

   openLogFile();

   for (int searchDepth = 1; searchDepth <= 2; searchDepth++)
   {
      for (int strategy = 0; strategy < FINDMOVE_NUM_STRATEGIES; strategy++)
      {
         setStrategy(strategy);
         for (int i = 0; i < 30; i++)
         {
            begin = clock();
            totalMoves = 0;
            Grid grid(20,10,5);
            while (!grid.isFinished())
            {
               numMoves = grid.findPossibleMoves().size();
               if (numMoves < 10)
                  c = findBestMoveWithSearchDepth(grid, searchDepth);
               else 
                  c = findBestMoveWithSearchDepth(grid, 1);
               
               grid.makeMove(c);
               totalMoves++;
               grid.calculateGroups();
            }
            numGroupsLeft = grid.getNumGroups();
            end = clock();
            writeOutput(strategy, searchDepth, numGroupsLeft, totalMoves, (double)(end-begin)/CLOCKS_PER_SEC);
         }
      }
   }
   closeLogFile();
}
    DifferentialEvolution::DifferentialEvolution(
		const Array& minParams, const Array& maxParams,
		DifferentialEvolution::Strategy strategy,
		Real F, Real CR, bool adaptive, Size nPop)
	: minParams_(minParams), maxParams_(maxParams),
	  nParam_(minParams_.size()),
      nPop_(nPop == Null<Size>() ? minParams.size()*10 : nPop),
	  strategy_(strategy), adaptive_(adaptive),F_(F), CR_(CR) {

		QL_REQUIRE(minParams_.size() == maxParams_.size(),
			"Need same number of minimum and maximum start parameters");
		for (Size i=0; i<nParam_; ++i) {
			QL_REQUIRE(minParams_[i] < maxParams_[i],
				"Minimum start parameter number " << i 
				<< " must be smaller than maximum start parameter");
		}
		QL_REQUIRE(F_ >= 0.0 && F_ <= 2.0,
			"F must be between 0.0 and 2.0");
		QL_REQUIRE(CR_ >= 0.0 && CR_ <= 1.0,
			"CR must be between 0.0 and 1.0");

		setStrategy();
	}
Ejemplo n.º 12
0
void
FlushEngine::triggerFlush()
{
    setStrategy(std::make_shared<FlushAllStrategy>());
}
Ejemplo n.º 13
0
	//kPlayer::kPlayer(const char* filename,const rlib::AnalogStick* stick,const rlib::IButton* button):ICharacter(filename,stick,button){setStrategy(new kPlayerFuseIn(this));}
	kPlayer::kPlayer(const char* filename,const rlib::AnalogStick* stick,const rlib::IButton* button):ICharacter(filename,stick,button){
		setStrategy(new kPlayerMove(this));
	}
Ejemplo n.º 14
0
	kPlayer::kPlayer(const char* filename):ICharacter(filename){setStrategy(new kPlayerFuseIn(this));}
Ejemplo n.º 15
0
/**
 * @brief Copy constructor.
 */
AIPlayer::AIPlayer(const AIPlayer &player)
{
  setStrategy(player.playerType);
}
Ejemplo n.º 16
0
PlannerStrategy& PlannerStrategy::operator=(const PlannerStrategy& other) {

	setStrategy(other.getStrategy());

	return *this;
}
Ejemplo n.º 17
0
//---------------------------------------------------------------------
void PagedWorldSection::setStrategy(const String& stratName)
{
    setStrategy(getManager()->getStrategy(stratName));
}
Ejemplo n.º 18
0
/**
 * @brief Creates new PC player.
 */
AIPlayer::AIPlayer(AIPlayerType playerType)
{
  setStrategy(playerType);
}