edu.ntnu.ecosim.environment
Class Market

java.lang.Object
  extended by edu.ntnu.ecosim.environment.Market

public class Market
extends java.lang.Object

The Market is where consumers and service providers operate. The market holds lists of all actors that are added, and some functionality for activating the agents.


Constructor Summary
Market(SimulationManager sm)
          The Market constructor.
 
Method Summary
 void addConsumer()
          Adds one consumer to the market.
 void addConsumer(ServiceProvider sp)
          Adds one bound consumer to the market
 void addInitialConsumers(int nofConsumers)
          Adds the initial (unbound) consumers.
 void addServiceProvider(java.lang.String name, int initsub, double subFee, double bindFee, java.lang.String strategy, int innostr, int innotype, int ecofl)
          Method to add one service provider to the market
 Consumer getConsumer(int uniqueID)
          Method to get a consumer from the list of consumers
 int getConsumerPlanningHorizon()
          Method to get the planning horizon of consumers
 double getInterestRate()
          Method to get the interest rate in the market
 int getNofConsumers()
          Gets the total number of consumers in the market
 int getNofProviders()
          Gets the number of service providers in the market.
 ServiceProvider getServiceProvider(int no)
          Gets the service provider according to the location in the list
 int getSimulationSpeed()
          Method to get the simulation speed
 int getTime()
          Gets the time of the clock (the number of months the simulation has run)
 int getTimeLeft()
          Gets the time left of the simulation.
 int getTimeToRun()
          Method to get the total number of time steps for this simulation
 int getUnboundConsumers()
          Gets the number of unbound consumers in the market.
 boolean isStopped()
          Gets whether or not the market i stopped
 void newTimeStep()
          This method is called for every timestep.
 void reinitMarket()
          Re-initialize the market.
 void setSimulationSpeed(int ssp)
          Method to set the simulation speed
 void setTimeToRun(int ttr)
          Method to set the number of intervals the simulator should run (time steps)
 void simulationDone()
          Method to be called when the simulation is done
 void startMarket()
          Starts the simulation of the market.
 void stopMarket()
          Stops the simulation of the market.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Market

public Market(SimulationManager sm)
The Market constructor.

Method Detail

addConsumer

public void addConsumer()
Adds one consumer to the market.


addConsumer

public void addConsumer(ServiceProvider sp)
Adds one bound consumer to the market

Parameters:
sp - the service provider the consumer is bound to

addInitialConsumers

public void addInitialConsumers(int nofConsumers)
Adds the initial (unbound) consumers.

Parameters:
nofConsumers - The number of consumers to add

addServiceProvider

public void addServiceProvider(java.lang.String name,
                               int initsub,
                               double subFee,
                               double bindFee,
                               java.lang.String strategy,
                               int innostr,
                               int innotype,
                               int ecofl)
                        throws NoSuchStrategyException
Method to add one service provider to the market

Parameters:
name - The name of the service provider
initsub - The number of initial subscribers
subFee - The subscription fee for this provider
bindFee - The binding fee for the provider
strategy - The strategy (innovative, reactive, innoreactive, etc.) for this provider
innostr - The innovative strength (between 0 and 10)
innotype - The innovation type this company develops (between 0 and 10, where 0 is "only value-adding" and 10 is "only network effect adding")
ecofl - The economic flexibility of this company (between 0 and 10)
Throws:
NoSuchStrategyException - If the specified strategy could not be found.

getConsumer

public Consumer getConsumer(int uniqueID)
Method to get a consumer from the list of consumers

Parameters:
uniqueID - the unique ID of the consumer
Returns:
the consumer

getConsumerPlanningHorizon

public int getConsumerPlanningHorizon()
Method to get the planning horizon of consumers

Returns:
the consumerPlanningHorizon

getInterestRate

public double getInterestRate()
Method to get the interest rate in the market

Returns:
the interest rate

getNofConsumers

public int getNofConsumers()
Gets the total number of consumers in the market

Returns:
the number of consumers

getNofProviders

public int getNofProviders()
Gets the number of service providers in the market.

Returns:
The number of service providers in the market

getServiceProvider

public ServiceProvider getServiceProvider(int no)
Gets the service provider according to the location in the list

Parameters:
no - the location in the list
Returns:
the service provider

getSimulationSpeed

public int getSimulationSpeed()
Method to get the simulation speed

Returns:
the sleep time (milliseconds) of the main thread

getTime

public int getTime()
Gets the time of the clock (the number of months the simulation has run)

Returns:
the time

getTimeLeft

public int getTimeLeft()
Gets the time left of the simulation.

Returns:
the time left

getTimeToRun

public int getTimeToRun()
Method to get the total number of time steps for this simulation

Returns:
the number of time steps

getUnboundConsumers

public int getUnboundConsumers()
Gets the number of unbound consumers in the market.

Returns:
the number of unbound consumers

isStopped

public boolean isStopped()
Gets whether or not the market i stopped

Returns:
the stopped

newTimeStep

public void newTimeStep()
This method is called for every timestep. The method activates all agents in the market.


reinitMarket

public void reinitMarket()
Re-initialize the market. This method resets all crucial parameters and prepares the market for the next simulation


setSimulationSpeed

public void setSimulationSpeed(int ssp)
Method to set the simulation speed

Parameters:
ssp - the "sleep time" of the main thread

setTimeToRun

public void setTimeToRun(int ttr)
Method to set the number of intervals the simulator should run (time steps)

Parameters:
ttr - the number of time steps that should be run

simulationDone

public void simulationDone()
Method to be called when the simulation is done


startMarket

public void startMarket()
Starts the simulation of the market.


stopMarket

public void stopMarket()
Stops the simulation of the market.