void RaceDialog::recountParts() { getBodyParts(ESM::BodyPart::MP_Hair, mAvailableHairs); getBodyParts(ESM::BodyPart::MP_Head, mAvailableHeads); mFaceIndex = 0; mHairIndex = 0; }
void EvolutionOfMorphologyAndBehavior::setupCreatures() { for (int i = 0; i < getPopulationSize(); ++i) { setCreature(i, new Creature(getBodyParts(), getBodyParts() - 1, getHiddenLayers(), getNeuronsPerLayer())); } std::vector<TreeOfNodes*>* morphs = TreeGenerator::createAllTrees(getBodyParts()); setNumberOfMorphologies(morphs->size()); _morphologies = new TreeOfNodes*[morphs->size()]; for (int i = 0; i < morphs->size(); ++i) { setMorphology(i, morphs->at(i)); } delete morphs; }
void EvolutionOfMorphologyAndBehavior::setupPsoModel() { getPsoModel().setEnvy(2.0); getPsoModel().setNostalgia(2.0); getPsoModel().setLowerFitnessBetter(false); getPsoModel().setCurrentIteration(0); getPsoModel().setSharingMethod(new RingSharingMethod(2)); // getPsoModel().setSharingMethod(new StarSharingMethod()); // getPsoModel().setVelocityClampingMethod(new BasicVelocityClamping()); getPsoModel().setVelocityClampingMethod(new TanhVelocityClamping()); // getPsoModel().setInertiaUpdateMethod(NULL); getPsoModel().setInertiaUpdateMethod(new LinearDecreasingInertia(0.75 * getMaxIterations())); int particle_size = 0; //Morphology //[index] particle_size += 1; //BodyPart //[ shape | size-x | size-y | size-z | mass ] particle_size += getBodyParts() * 5; //Constraints //[ connection-point | parent-connection-point | // cone_swing_x_limit | cone_swing_z_limit | cone_twist_limit ] particle_size += (getBodyParts() - 1) * 5; //NeuralNetwork particle_size += getCreature(0).getNeuralNetwork().getTotalNumberOfWeights(); PsoParticle particle(particle_size); particle.setMaxPosition(99.99999); particle.setMaxVelocity(25.0); particle.setMinPosition(0); particle.setSpace(PsoParticle::S_CONTINUOUS); PsoParticle* clone = NULL; for (int i = 0; i < getPsoModel().getSize(); ++i) { clone = particle.clone(); getPsoModel().initialize(*clone); getPsoModel().setParticle(i, clone); } }
bool CSMWorld::Data::hasId (const std::string& id) const { return getGlobals().searchId (id)!=-1 || getGmsts().searchId (id)!=-1 || getSkills().searchId (id)!=-1 || getClasses().searchId (id)!=-1 || getFactions().searchId (id)!=-1 || getRaces().searchId (id)!=-1 || getSounds().searchId (id)!=-1 || getScripts().searchId (id)!=-1 || getRegions().searchId (id)!=-1 || getBirthsigns().searchId (id)!=-1 || getSpells().searchId (id)!=-1 || getTopics().searchId (id)!=-1 || getJournals().searchId (id)!=-1 || getCells().searchId (id)!=-1 || getEnchantments().searchId (id)!=-1 || getBodyParts().searchId (id)!=-1 || getSoundGens().searchId (id)!=-1 || getMagicEffects().searchId (id)!=-1 || getReferenceables().searchId (id)!=-1; }