void Expectations::generateExp() { setStrategy(new Algo(UTManager::instance().student(), exp_)); exp_->setSemesters(autocompletion_->run()); createExpPanel(); }
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); }
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); }
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); } }
// 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(); }
//--------------------------------------------------------------------- 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; }
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(); }
void FlushEngine::triggerFlush() { setStrategy(std::make_shared<FlushAllStrategy>()); }
//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)); }
kPlayer::kPlayer(const char* filename):ICharacter(filename){setStrategy(new kPlayerFuseIn(this));}
/** * @brief Copy constructor. */ AIPlayer::AIPlayer(const AIPlayer &player) { setStrategy(player.playerType); }
PlannerStrategy& PlannerStrategy::operator=(const PlannerStrategy& other) { setStrategy(other.getStrategy()); return *this; }
//--------------------------------------------------------------------- void PagedWorldSection::setStrategy(const String& stratName) { setStrategy(getManager()->getStrategy(stratName)); }
/** * @brief Creates new PC player. */ AIPlayer::AIPlayer(AIPlayerType playerType) { setStrategy(playerType); }