void loadHelper() { int from[2],to[2]; from[0] = F1H; to[0] = L1H; from[1] = 0; to[1] = F1H; loadWeights(from,to,0); from[0] = FO; to[0] = LO; from[1] = F1H; to[1] = L1H+1; loadWeights(from,to,1); }
/** Loads all powerups from the powerup.xml file. * Uses num_karts to get the good weights */ void PowerupManager::loadAllPowerups(unsigned int num_karts) { const std::string file_name = file_manager->getAsset("powerup.xml"); XMLNode *root = file_manager->createXMLTree(file_name); for(unsigned int i=0; i<root->getNumNodes(); i++) { const XMLNode *node=root->getNode(i); if(node->getName()!="item") continue; std::string name; node->get("name", &name); PowerupType type = getPowerupType(name); // The weight nodes will be also included in this list, so ignore those if(type!=POWERUP_NOTHING) LoadPowerup(type, *node); else { Log::fatal("[PowerupManager]", "Can't find item '%s' from powerup.xml, entry %d/", name.c_str(), i+1); exit(-1); } } loadWeights(*root, num_karts, "first", POSITION_FIRST ); loadWeights(*root, num_karts, "top25", POSITION_TOP25 ); loadWeights(*root, num_karts, "midtop25", POSITION_MIDTOP25 ); loadWeights(*root, num_karts, "midend25", POSITION_MIDEND25 ); loadWeights(*root, num_karts, "end25", POSITION_END25 ); loadWeights(*root, num_karts, "last" , POSITION_LAST ); loadWeights(*root, num_karts, "battle" , POSITION_BATTLE_MODE); loadWeights(*root, num_karts, "tuto", POSITION_TUTORIAL_MODE); delete root; } // loadAllPowerups
int main(int argc, char** argv){ Parameters param(argc, argv); srand(param.seed); RAMFeatures ramFeatures; BPROFeatures bproFeatures(param.gameName); vector<vector<vector<float> > > w; loadWeights(param, &bproFeatures, w); ALEInterface ale(0); ale.setInt ("random_seed" , param.seed); ale.setInt ("max_num_frames_per_episode", 18000 ); ale.setBool ("color_averaging" , true ); ale.setFloat("frame_skip" , 1 ); ale.setFloat("repeat_action_probability" , 0.00 ); ale.loadROM(param.romPath.c_str()); for(int i = 0; i < 2 * NUM_BITS; i++){ frequency.push_back(0.0); } int totalNumFrames = 0; for(int episode = 0; totalNumFrames < MAX_NUM_FRAMES; episode++){ totalNumFrames = playGame(ale, &ramFeatures, &bproFeatures, w, param, totalNumFrames, episode); totalNumFrames += ale.getEpisodeFrameNumber(); } return 0; }
// // Creating Neural Network from file // void NN_File::loadFromFile(const std::string & fileName) { TiXmlDocument doc(fileName); doc.LoadFile(); TiXmlElement * pRoot = doc.RootElement(); loadNetwork(pRoot); loadWeights(pRoot->FirstChildElement("weights")); }
SemposScorer::SemposScorer(const string& config) : StatisticsBasedScorer("SEMPOS", config), m_ovr(SemposOverlappingFactory::GetOverlapping(getConfig("overlapping", "cap-micro"),this)), m_enable_debug(false) { const string& debugSwitch = getConfig("debug", "0"); if (debugSwitch == "1") m_enable_debug = true; m_semposMap.clear(); string weightsfile = getConfig("weightsfile", ""); if (weightsfile != "") { loadWeights(weightsfile); } }
void Wfile::initialize(boost::shared_ptr<XenFile> ptrFile) { try { if (boost::filesystem::exists(ptrFile->getFullPath().c_str())) { std::cout << "Using existing weights file " << ptrFile->getFullPath() << std::endl; this->ptrFile = ptrFile; loadWeights(); calibrate(); } else { throw XenCommon::XenCEption("Specified weights file " + ptrFile->getFullPath() + " does not exists!"); } } catch (XenCommon::XenCEption &e) { throw; } }
void load(Archive& ar, const unsigned /*version*/) { weights = loadWeights(ar); }