Sector.Stats Class Reference

Some statics values of a single Sector (as a sum of all Firms in the Sector). More...

List of all members.

Package Attributes

double overallProduction = 0.d
 The total production in the sector.
double averageGrowthRateProduction = 0.d
 The average growth rate of production in the sector.

Private Member Functions

void registerCallbacks (StepManager pStepManager)
void calcPrices ()
 Calculate the average and maximal supply price over all firms in the sector.
void calcDesiredProduction ()
 Calculate the average desired production over all firms in the sector.
double[] calcFixedCapitalStock ()
 Calculate the sum of the fixed capital of all firms in the sector.
double[] calcCirculatingCapitalStock ()
 Calculate the sum of the circulating capital of all firms in the sector.
void updateTradingStats ()
 Calculate the average trade price and the trade value.

Private Attributes

double fixedCapitalStock []
 The sum of the capital stock of all firms in the sector after trading.
double fixedCapitalStockLastPeriod []
 The sum of the capital stock of all firms in the sector in the last period.
double maxFixedCapitalStock []
 The highest capital stock that existed in a simulation run.
boolean neverCalcedFixedCapitalStock = true
 Is used as a marker that we are in the first period.
double averageWageReference
 The average over the wage reference over all firms in the sector normed by the target employment of the firms.
double averageLaborCapacity
 The quotient averageEmployment/averageTargetEmployment.
double averageCosts
 The average over the production costs of all firms in the sector.
double averageBenchmarkCosts
 The average over the benchmark production costs of all firms in the sector.
double averageDebt
 The average debt over all firms in the sector.
double averageRevenue
 The average revenue (sold quantity * price) over all firms in the sector.
double averageTargetEmployment
 The average target employment over all firms in the sector.
double averageEmployment
 The average realized employment over all firms in the sector.
double averageProfit
 The average firm profit over all firms in the sector.
double sectorProfitRate
 The average profit rate over all firms in the sector normed by the produced quantities.
double averageSupplyPriceWithoutImport
 The average supply price over all firms in the sector.
double averageTradePrice = 1.d
 The average price of traded goods produced in the sector, incl.
double averageTradePriceLastPeriod = 1.d
 The average price of traded goods produced in the sector, incl.
double tradeValue = 0.d
 The overall trade value (quantity * price) of all in the actual period sold goods.
double tradeValueLastPeriod = 0.d
 The overall trade value (quantity * price) of all in the last period sold goods.
double maxPrice = 0.d
 The highest supply price of a firm in the sector.
double averageMarkUp = 0.d
 The average mark-up over costs of firms in that sector.
double deviationMarkUp = 0.d
 The standard deviation of mark-up over firms in that sector.
double averageDesiredProduction
 The average desired production over all firms in the sector.
double totalDesiredProduction
 The total desired production over all firms in the sector.
ValueMemory memoryProfit
 The overall profits of the last FoundationInitValues.firmEntryAndExitInterval periods.
ValueMemory memoryProfitRate
 The sector profit rates of the last FoundationInitValues.firmEntryAndExitInterval periods.
ValueMemory memoryProduction
 The sector production of the last FoundationInitValues.firmEntryAndExitInterval periods.
ValueMemory memoryLaborProductivityGrowthRate
 The labor productivity growth rates of the last FoundationInitValues.benchmarkWageInterval periods.

Classes

class  StepCallback


Detailed Description

Some statics values of a single Sector (as a sum of all Firms in the Sector).

Definition at line 544 of file Sector.java.


Member Function Documentation

void registerCallbacks ( StepManager  pStepManager  )  [private]

Update the Sector Statistics.

There are two different mechanism to determine the statistics right now, the first mechanism gather the needed information right now in the update method itself, the second one gets the values via callback mechanisms and only the average values are calculated here.

Definition at line 747 of file Sector.java.

00747                                                              {
00748       pStepManager.registerCallback(Foundation.EXCHANGE_STEP,
00749                                     StepManager.Timing.POST,
00750                                     1,
00751                                     new StepCallback() {
00759         @Override
00760         public void postStep() {
00761           fixedCapitalStockLastPeriod = fixedCapitalStock;
00762           fixedCapitalStock = calcFixedCapitalStock();
00763           if (neverCalcedFixedCapitalStock == true) {
00764             fixedCapitalStockLastPeriod = fixedCapitalStock;
00765             maxFixedCapitalStock = fixedCapitalStock;
00766             neverCalcedFixedCapitalStock = false;
00767           }
00768           
00769           
00770         maxFixedCapitalStock = ArrayTools.maxArrays(maxFixedCapitalStock,
00771                                                       fixedCapitalStockLastPeriod);
00772                   
00773           
00774           updateTradingStats();
00775         }
00776       }
00777       );
00778 
00779       pStepManager.registerCallback(Foundation.PRODUCTION_STEP,
00780                                     StepManager.Timing.POST,
00781                                     1,
00782                                     new StepCallback() {
00783         @Override
00784         public void postStep() {
00785           overallProduction = 0.d;
00786           averageGrowthRateProduction = 0.d;
00787           for (final Firm lFirm : firmList) {
00788             overallProduction += lFirm.getProducedQuantity();
00789             averageGrowthRateProduction += lFirm.getProducedQuantity()
00790                                             * lFirm.getRateProductionUp();
00791           }
00792           memoryProduction.add(overallProduction);
00793           if (overallProduction > 0.d){
00794             averageGrowthRateProduction /= overallProduction;
00795           }
00796         }
00797       }
00798       );
00799 
00800       pStepManager.registerCallback(Foundation.FIRMS_ADJUST_WORKFORCE_STEP,
00801                                     StepManager.Timing.POST,
00802                                     1,
00803                                     new StepCallback() {
00804         @Override
00805         public void postStep() {
00806           averageWageReference = 0.d;
00807           averageLaborCapacity=0;
00808           averageTargetEmployment = 0.d;
00809           averageEmployment = 0.d;
00810           for (final Firm lFirm : firmList) {
00811             averageTargetEmployment += lFirm.getTargetEmployment();
00812             averageEmployment += lFirm.calcWorkAmount();
00813             averageWageReference += lFirm.getTargetEmployment()* lFirm.getWageReference();
00814           }
00815           assert(averageWageReference>0);
00816           assert( averageTargetEmployment>0);
00817           assert (! Double.isNaN(averageWageReference));
00818           averageWageReference /= averageTargetEmployment;
00819           assert (! Double.isNaN(averageWageReference));
00820           averageTargetEmployment /= getNumFirms();
00821           averageEmployment /= getNumFirms();
00822           averageLaborCapacity= averageEmployment/averageTargetEmployment;
00823         }
00824       }
00825       );
00826 
00827       pStepManager.registerCallback(Foundation.FIRMS_DESIRED_PRODUCTION_UPDATING_STEP,
00828                                     StepManager.Timing.POST,
00829                                     1,
00830                                     new StepCallback() {
00831         @Override
00832         public void postStep() {
00833           calcDesiredProduction();
00834         }
00835       }
00836       );
00837 
00838       pStepManager.registerCallback(Foundation.UPDATE_LABOR_PRODUCTIVITY_STEP,
00839                                     StepManager.Timing.POST,
00840                                     1,
00841                                     new StepCallback() {
00842         @Override
00843         public void postStep() {
00844           memoryLaborProductivityGrowthRate.add(laborProductivityGrowthRate);
00845         }
00846       }
00847       );
00848 
00849       pStepManager.registerCallback(Foundation.GENETIC_EVOLUTION_OF_PRICES_STEP,
00850                                     StepManager.Timing.POST,
00851                                     1,
00852                                     new StepCallback() {
00853         @Override
00854         public void postStep() {
00855           calcPrices();
00856         }
00857       }
00858       );
00859 
00860       pStepManager.registerCallback(Foundation.FIRM_ACCOUNTING_STEP,
00861                                     StepManager.Timing.POST,
00862                                     1,
00863                                     new StepCallback() {
00864         @Override
00865         public void postStep() {
00866           averageProfit = 0.d;
00867           sectorProfitRate = 0.d;
00868           averageDebt = 0.d;
00869           averageCosts = 0.d;
00870           averageBenchmarkCosts = 0.d;
00871           averageRevenue = 0.d;
00872           averageMarkUp = 0.d;
00873           deviationMarkUp=0.d;
00874           int nFirm =0;
00875           for (final Firm lFirm : firmList) {
00876             nFirm++;
00877             averageProfit = ((nFirm-1)*averageProfit +lFirm.getProfit())/nFirm;
00878             averageDebt = ((nFirm-1)*averageDebt +lFirm.getDebt())/nFirm;
00879             averageCosts= ((nFirm-1)*averageCosts +lFirm.getCosts())/nFirm;
00880             averageBenchmarkCosts = ((nFirm-1)*averageBenchmarkCosts +lFirm.getBenchmarkCosts())/nFirm;
00881             averageRevenue =  ((nFirm-1)*averageRevenue + lFirm.getPrice() * lFirm.getSoldQuantity())/nFirm;
00882             double lOldAverageMarkUp = averageMarkUp;
00883             averageMarkUp = ((nFirm-1)*averageMarkUp +lFirm.getMarkUp())/nFirm;
00884             deviationMarkUp=((nFirm-1)*deviationMarkUp+
00885                 (lFirm.getMarkUp()-averageMarkUp)*(lFirm.getMarkUp()-lOldAverageMarkUp))/nFirm;
00886             sectorProfitRate += lFirm.getProfitRate() * lFirm.getProducedQuantity();
00887           }
00888           if (overallProduction > 0.d){
00889             sectorProfitRate /= overallProduction;
00890           }
00891           deviationMarkUp=Math.sqrt(deviationMarkUp);
00892           memoryProfit.add(averageProfit);
00893           memoryProfitRate.add(sectorProfitRate);
00894         }
00895       }
00896       );
00897     }

void calcPrices (  )  [private]

Calculate the average and maximal supply price over all firms in the sector.

Definition at line 900 of file Sector.java.

00900                               {
00901       averageSupplyPriceWithoutImport = 0.d;
00902       maxPrice = 0.d;
00903       for (final Firm lFirm : firmList) {
00904         averageSupplyPriceWithoutImport += lFirm.getPrice()*lFirm.getProducedQuantity();
00905         maxPrice = Math.max(maxPrice, lFirm.getPrice());
00906       }
00907       averageSupplyPriceWithoutImport /= getOverallProduction();
00908     }

void calcDesiredProduction (  )  [private]

Calculate the average desired production over all firms in the sector.

Definition at line 911 of file Sector.java.

00911                                          {
00912       totalDesiredProduction=0;
00913       averageDesiredProduction = 0.d;
00914       for (final Firm lFirm : firmList) {
00915         totalDesiredProduction += lFirm.getDesiredProduction();
00916       }
00917       averageDesiredProduction = totalDesiredProduction/ getNumFirms();
00918     }

double [] calcFixedCapitalStock (  )  [private]

Calculate the sum of the fixed capital of all firms in the sector.

Definition at line 921 of file Sector.java.

00921                                              {
00922       double[] lFCS = new double[foundation.getNumSectors()];
00923       for (final Firm lFirm : firmList) {
00924         lFCS = ArrayTools.addArrays(lFCS, lFirm.getFixedCapital());
00925       }
00926       return lFCS;
00927     }

double [] calcCirculatingCapitalStock (  )  [private]

Calculate the sum of the circulating capital of all firms in the sector.

Definition at line 930 of file Sector.java.

00930                                                    {
00931       double[] lCCS = new double[foundation.getNumSectors()];
00932       for (final Firm lFirm : firmList) {
00933         lCCS = ArrayTools.addArrays(lCCS, lFirm.getCirculatingCapital());
00934       }
00935       return lCCS;
00936     }

void updateTradingStats (  )  [private]

Calculate the average trade price and the trade value.

Definition at line 940 of file Sector.java.

00940                                       {
00941       final TradeTrace tradeTrace = foundation.getTradeTrace();
00942       averageTradePriceLastPeriod = averageTradePrice;
00943       averageTradePrice = tradeTrace.getAverageTradePriceSelledInSector(Sector.this);
00944       if (Double.isNaN(averageTradePrice)) {
00945         averageTradePrice = averageTradePriceLastPeriod;
00946       }
00947 
00948       tradeValueLastPeriod = tradeValue;
00949       tradeValue = tradeTrace.getOverallTradeValueSelledInSector(Sector.this);
00950     }


Member Data Documentation

double fixedCapitalStock[] [private]

The sum of the capital stock of all firms in the sector after trading.

Definition at line 556 of file Sector.java.

double fixedCapitalStockLastPeriod[] [private]

The sum of the capital stock of all firms in the sector in the last period.

Definition at line 561 of file Sector.java.

double maxFixedCapitalStock[] [private]

The highest capital stock that existed in a simulation run.

Definition at line 566 of file Sector.java.

boolean neverCalcedFixedCapitalStock = true [private]

Is used as a marker that we are in the first period.

Definition at line 569 of file Sector.java.

double averageWageReference [private]

The average over the wage reference over all firms in the sector normed by the target employment of the firms.

Definition at line 578 of file Sector.java.

double averageLaborCapacity [private]

The quotient averageEmployment/averageTargetEmployment.

Definition at line 583 of file Sector.java.

double averageCosts [private]

The average over the production costs of all firms in the sector.

Definition at line 588 of file Sector.java.

double averageBenchmarkCosts [private]

The average over the benchmark production costs of all firms in the sector.

Definition at line 593 of file Sector.java.

double averageDebt [private]

The average debt over all firms in the sector.

Definition at line 598 of file Sector.java.

double averageRevenue [private]

The average revenue (sold quantity * price) over all firms in the sector.

Definition at line 603 of file Sector.java.

double averageTargetEmployment [private]

The average target employment over all firms in the sector.

Definition at line 608 of file Sector.java.

double averageEmployment [private]

The average realized employment over all firms in the sector.

Definition at line 613 of file Sector.java.

double averageProfit [private]

The average firm profit over all firms in the sector.

Definition at line 618 of file Sector.java.

double sectorProfitRate [private]

The average profit rate over all firms in the sector normed by the produced quantities.

Definition at line 627 of file Sector.java.

double averageSupplyPriceWithoutImport [private]

The average supply price over all firms in the sector.

Definition at line 632 of file Sector.java.

double averageTradePrice = 1.d [private]

The average price of traded goods produced in the sector, incl.

imports and exports, in the actual period (after the trading step).

Definition at line 641 of file Sector.java.

double averageTradePriceLastPeriod = 1.d [private]

The average price of traded goods produced in the sector, incl.

imports and exports, in the last period.

Definition at line 650 of file Sector.java.

double tradeValue = 0.d [private]

The overall trade value (quantity * price) of all in the actual period sold goods.

Definition at line 656 of file Sector.java.

double tradeValueLastPeriod = 0.d [private]

The overall trade value (quantity * price) of all in the last period sold goods.

Definition at line 662 of file Sector.java.

double maxPrice = 0.d [private]

The highest supply price of a firm in the sector.

Definition at line 667 of file Sector.java.

double averageMarkUp = 0.d [private]

The average mark-up over costs of firms in that sector.

Definition at line 672 of file Sector.java.

double deviationMarkUp = 0.d [private]

The standard deviation of mark-up over firms in that sector.

Definition at line 677 of file Sector.java.

double overallProduction = 0.d [package]

The total production in the sector.

Definition at line 682 of file Sector.java.

double averageGrowthRateProduction = 0.d [package]

The average growth rate of production in the sector.

Definition at line 686 of file Sector.java.

double averageDesiredProduction [private]

The average desired production over all firms in the sector.

Definition at line 691 of file Sector.java.

double totalDesiredProduction [private]

The total desired production over all firms in the sector.

Definition at line 696 of file Sector.java.

ValueMemory memoryProfit [private]

The overall profits of the last FoundationInitValues.firmEntryAndExitInterval periods.

Definition at line 704 of file Sector.java.

ValueMemory memoryProfitRate [private]

The sector profit rates of the last FoundationInitValues.firmEntryAndExitInterval periods.

Definition at line 712 of file Sector.java.

ValueMemory memoryProduction [private]

The sector production of the last FoundationInitValues.firmEntryAndExitInterval periods.

Definition at line 719 of file Sector.java.

ValueMemory memoryLaborProductivityGrowthRate [private]

The labor productivity growth rates of the last FoundationInitValues.benchmarkWageInterval periods.

Definition at line 727 of file Sector.java.


The documentation for this class was generated from the following file:
Generated on Tue Sep 14 11:11:49 2010 for lagom_generiC by  doxygen 1.5.4