Public Member Functions | |
void | init (Sector pSector) |
Initialize the ImportExport agent. | |
void | trade () |
The ImportExport agent buy goods from firms in the economy and export those goods. | |
void | account () |
Calculate maxImport/ExportInPeriod for the next period and reset import/exportLeft. | |
void | sell (double pQuantity) |
| |
double | getPrice () |
| |
double | getInventory () |
| |
Sector | getProductionSector () |
| |
Package Functions | |
ImportExport (Foundation pFoundation, ImportExportInitValues pInitValues) | |
The constructor of the ImportExport agent. | |
Package Attributes | |
double | maxImportInPeriod |
The maximal units of goods that can be imported in this period. | |
double | importLeft |
The number of units that can be imported at the actual time. | |
double | maxExportInPeriod |
The maximal units of goods that can be exported in this period. | |
double | exportLeft |
The number of units that can be exported at the actual time. | |
Classes | |
class | Probe |
For each sector a single instance of this class exist. The agent buys and sells goods of the corresponding sector. He buys x units after all other agents have traded, where x is determined by parameters in ImportExportInitValues. He sells goods to a buyer in the case that the buyer couldn't satisfy his needs with the inventory from the observed firms.
Definition at line 37 of file ImportExport.java.
ImportExport | ( | Foundation | pFoundation, | |
ImportExportInitValues | pInitValues | |||
) | [package] |
The constructor of the ImportExport agent.
pFoundation | The model foundation | |
pInitValues | The init values of the ImportExport agent |
Definition at line 163 of file ImportExport.java.
void init | ( | Sector | pSector | ) |
Initialize the ImportExport agent.
It calculate the maximal import/export of the first period by multiplying a given coefficient with the initial production/consumption in the corresponding sector.
pSector | An agent correspond to the sector pSector (it buys and sells goods of this sector). |
Definition at line 177 of file ImportExport.java.
Referenced by Sector.init(), and ImportExport.init().
00177 { 00178 sector = pSector; 00179 maxImportInPeriod = sector.getInitProduction() * 00180 initValues.getInitialMaxImportAsOverallProductionFactorArray()[sector.getArrayIndex()]; 00181 importLeft = maxImportInPeriod; 00182 00183 maxExportInPeriod = sector.getInitConsumption() * 00184 initValues.getInitialMaxExportAsOverallProductionFactorArray()[sector.getArrayIndex()]; 00185 exportLeft = maxExportInPeriod; 00186 00187 probe.init(); 00188 00189 suppliers.init(foundation, this, pSector, initValues.getObservedSuppliersQuotient()); 00190 }
void trade | ( | ) |
The ImportExport agent buy goods from firms in the economy and export those goods.
Implements IBuyer.
Definition at line 199 of file ImportExport.java.
00199 { 00200 suppliers.updateSuppliers(Suppliers.SellerSet.EXCLUDE_IMPORT); 00201 //add supppliers in case of rationning 00202 suppliers.addSuppliers(exportLeft, Suppliers.SellerSet.EXCLUDE_IMPORT); 00203 // buy 00204 final double lTrade = Math.min(exportLeft, suppliers.maxSupply()); 00205 suppliers.buy(lTrade); 00206 exportLeft -= lTrade; 00207 }
void account | ( | ) |
Calculate maxImport/ExportInPeriod for the next period and reset import/exportLeft.
Definition at line 212 of file ImportExport.java.
00212 { 00213 maxImportInPeriod *= initValues.getGrowthOfMaxImport(); 00214 maxImportInPeriod= Math.max(maxImportInPeriod, sector.getOverallProduction() * 00215 initValues.getInitialMaxImportAsOverallProductionFactorArray()[sector.getArrayIndex()]); 00216 importLeft = maxImportInPeriod; 00217 00218 maxExportInPeriod = sector.getOverallProduction() * 00219 initValues.getInitialMaxExportAsOverallProductionFactorArray()[sector.getArrayIndex()]; 00220 exportLeft = maxExportInPeriod; 00221 }
void sell | ( | double | pQuantity | ) |
Implements ISeller.
Definition at line 227 of file ImportExport.java.
00227 { 00228 importLeft -= pQuantity; 00229 }
double getPrice | ( | ) |
double getInventory | ( | ) |
Implements ISeller.
Definition at line 241 of file ImportExport.java.
Referenced by Suppliers.addSuppliers(), and Suppliers.findSuppliers().
00241 { 00242 return importLeft; 00243 }
Sector getProductionSector | ( | ) |
Implements ISeller.
Definition at line 248 of file ImportExport.java.
double maxImportInPeriod [package] |
The maximal units of goods that can be imported in this period.
Definition at line 121 of file ImportExport.java.
Referenced by ImportExport.account(), and ImportExport.init().
double importLeft [package] |
The number of units that can be imported at the actual time.
This is equivalent to ImportExport.maxImportInPeriod less the already imported units in this period.
Definition at line 133 of file ImportExport.java.
Referenced by ImportExport.account(), ImportExport.getInventory(), ImportExport.init(), and ImportExport.sell().
double maxExportInPeriod [package] |
The maximal units of goods that can be exported in this period.
Definition at line 140 of file ImportExport.java.
Referenced by ImportExport.account(), and ImportExport.init().
double exportLeft [package] |
The number of units that can be exported at the actual time.
This is equivalent to ImportExport.maxExportedInPeriod less the already exported units in this period.
Definition at line 154 of file ImportExport.java.
Referenced by ImportExport.account(), ImportExport.init(), and ImportExport.trade().