Example #1
0
  /**
   * \brief Create a new agent in a specified position
   *
   * <p>Create a new agent in a specified position
   *
   * @param position Vector stating where this agent should be located
   */
  public void createNewAgent(ContinuousVector position) {
    try {
      // Get a clone of the progenitor
      LocatedAgent baby = (LocatedAgent) sendNewAgent();
      baby.giveName();

      // randomize its mass
      baby.mutatePop();

      baby.updateSize();

      this._myDivRadius = getDivRadius();
      baby._myDivRadius = getDivRadius();
      baby._myDeathRadius = getDeathRadius();

      // Just to avoid to be in the carrier
      position.x += this._totalRadius;

      baby.setLocation(position);

      baby.registerBirth();

    } catch (CloneNotSupportedException e) {
      utils.LogFile.writeLog("Error met in LocAgent:createNewAgent()");
    }
  }
Example #2
0
  /**
   * \brief On agent division, transfers EPS between the old and new agent, at a specified ratio
   *
   * <p>On agent division, transfers EPS between the old and new agent, at a specified ratio
   *
   * @param baby The new agent, which is inheriting mass
   * @param splitRatio The ratio of the EPS that should be transferred to the new agent
   */
  public void transferCompounds(LocatedAgent baby, double splitRatio) {
    // Choose the division plan and apply position modifications
    double m;
    for (int i = 0; i < particleMass.length; i++) {
      m = this.particleMass[i] * splitRatio;
      baby.particleMass[i] += m;
      this.particleMass[i] = this.particleMass[i] - m;
    }

    // Update radius, mass and volumes
    updateSize();
    baby.updateSize();
  }
Example #3
0
  /**
   * \brief On agent division, divides the mass between the old and new agent, at a specified
   * fraction
   *
   * <p>On agent division, divides the mass between the old and new agent, at a specified fraction
   *
   * @param baby The new agent, which is inheriting mass
   * @param babyMassFrac The fraction of this agents mass that should be transferred to the new
   *     agent
   */
  public void divideCompounds(LocatedAgent baby, double babyMassFrac) {
    // Choose the division plan and apply position modifications
    for (int i = 0; i < particleMass.length; i++) {
      baby.particleMass[i] *= babyMassFrac;
      this.particleMass[i] *= 1 - babyMassFrac;
    }

    // Update radius, mass, volumes and growth rates
    updateSize();
    baby.updateSize();

    updateGrowthRates();
    baby.updateGrowthRates();
  }