Пример #1
0
 /* (non-Javadoc)
  * @see jmab.report.MicroMultipleVariablesComputer#computeVariables(jmab.simulations.MacroSimulation)
  */
 @Override
 public Map<Long, Double> computeVariables(MacroSimulation sim) {
   MacroPopulation macroPop = (MacroPopulation) sim.getPopulation();
   Population pop = macroPop.getPopulation(householdId);
   TreeMap<Long, Double> result = new TreeMap<Long, Double>();
   for (Agent i : pop.getAgents()) {
     Households household = (Households) i;
     result.put(household.getAgentId(), household.getNetIncome());
   }
   return result;
 }
Пример #2
0
 /* (non-Javadoc)
  * @see jmab.report.VariableComputer#computeVariable(jmab.simulations.MacroSimulation)
  */
 @Override
 public double computeVariable(MacroSimulation sim) {
   MacroPopulation macroPop = (MacroPopulation) sim.getPopulation();
   double investments = 0;
   for (int i = 0; i < investorsPopIds.length; i++) {
     Population pop = macroPop.getPopulation(investorsPopIds[i]);
     for (Agent j : pop.getAgents()) {
       MacroAgent agent = (MacroAgent) j;
       if (!agent.isDead()) {
         for (int h = 0; h < capitalSMIds.length; h++) {
           List<Item> items = agent.getItemsStockMatrix(true, capitalSMIds[h]);
           for (Item item : items) {
             if (item.getAge() < 0) {
               investments += item.getValue();
             }
           }
         }
       }
     }
   }
   return investments;
 }