Package org.powertac.customer
Class AbstractCustomer
java.lang.Object
org.powertac.customer.AbstractCustomer
public abstract class AbstractCustomer extends Object
Abstract customer implementation
- Author:
- Antonios Chrysopoulos
-
Field Summary
Fields Modifier and Type Field Description protected List<org.powertac.common.CustomerInfo>allCustomerInfosprotected HashMap<org.powertac.common.enumerations.PowerType,List<org.powertac.common.CustomerInfo>>customerInfosprotected static org.apache.logging.log4j.Loggerlogprotected Stringnameprotected RandomSeedrs1Random Number Generatorprotected CustomerServiceAccessorservice -
Constructor Summary
Constructors Constructor Description AbstractCustomer()Default constructor, requires explicit setting of nameAbstractCustomer(String name)Abstract Customer constructor with explicit name. -
Method Summary
Modifier and Type Method Description voidaddCustomerInfo(org.powertac.common.CustomerInfo info)Adds an additional CustomerInfo to the listvoidchangeSubscription(org.powertac.common.Tariff tariff, org.powertac.common.Tariff newTariff, org.powertac.common.CustomerInfo customer)In this overloaded implementation of the changing subscription function, Here we just put the tariff we want to change and the whole population is moved to another random tariff.TariffEvaluatorcreateTariffEvaluator(CustomerModelAccessor cma)Creates a TariffEvaluator, populated with a pre-configured TariffEvaluationHelper.abstract voidevaluateTariffs(List<org.powertac.common.Tariff> tariffs)Called to evaluate tariffs.List<TariffSubscription>getCurrentSubscriptions()Returns the current tariff subscriptions for the first CustomerInfo.List<TariffSubscription>getCurrentSubscriptions(org.powertac.common.enumerations.PowerType type)Returns the current tariff subscriptions for the first CustomerInfo with the given PowerType.longgetCustId()org.powertac.common.CustomerInfogetCustomerInfo(org.powertac.common.enumerations.PowerType pt)Returns the first CustomerInfo associated with this instance and PowerType.List<org.powertac.common.CustomerInfo>getCustomerInfoList(org.powertac.common.enumerations.PowerType pt)Returns the list of CustomerInfos associated with this instance and PowerType.List<org.powertac.common.CustomerInfo>getCustomerInfos()Returns the list of CustomerInfo records associated with this customer model.longgetId()Synonym for getCustId()StringgetName()Returns the name of this modelintgetPopulation(org.powertac.common.CustomerInfo customer)voidinitialize()Initializes the instance.protected org.joda.time.InstantlastSunday()protected org.joda.time.InstantnextStartOfDay()voidsaveBootstrapState()Saves model data to the bootstrap record.voidsetName(String name)Sets the name for this modelvoidsetServiceAccessor(CustomerServiceAccessor csa)Provides a reference to the service accessor, through which we can get at sim servicesvoidsetTariffMarket(TariffMarket service)protected org.joda.time.InstantstartOfDay()abstract voidstep()Called to run the model forward one step.StringtoString()
-
Field Details
-
log
protected static org.apache.logging.log4j.Logger log -
name
-
customerInfos
-
allCustomerInfos
-
service
-
rs1
Random Number Generator
-
-
Constructor Details
-
AbstractCustomer
public AbstractCustomer()Default constructor, requires explicit setting of name -
AbstractCustomer
Abstract Customer constructor with explicit name.
-
-
Method Details
-
setServiceAccessor
Provides a reference to the service accessor, through which we can get at sim services -
initialize
public void initialize()Initializes the instance. Called after configuration, and after a call to setServices(). TODO -- do we really want this here? -
saveBootstrapState
public void saveBootstrapState()Saves model data to the bootstrap record. Default implementation does nothing; models may override if they aggregate objects that must save state. -
addCustomerInfo
public void addCustomerInfo(org.powertac.common.CustomerInfo info)Adds an additional CustomerInfo to the list -
getCustomerInfo
public org.powertac.common.CustomerInfo getCustomerInfo(org.powertac.common.enumerations.PowerType pt)Returns the first CustomerInfo associated with this instance and PowerType. It is up to individual models to fill out the fields. -
getCustomerInfoList
public List<org.powertac.common.CustomerInfo> getCustomerInfoList(org.powertac.common.enumerations.PowerType pt)Returns the list of CustomerInfos associated with this instance and PowerType. -
getCustomerInfos
Returns the list of CustomerInfo records associated with this customer model. -
getCurrentSubscriptions
Returns the current tariff subscriptions for the first CustomerInfo. Useful for customer models with a single CustomerInfo. -
getCurrentSubscriptions
public List<TariffSubscription> getCurrentSubscriptions(org.powertac.common.enumerations.PowerType type)Returns the current tariff subscriptions for the first CustomerInfo with the given PowerType. Useful for customer models with a single CustomerInfo per PowerType. -
toString
-
getPopulation
public int getPopulation(org.powertac.common.CustomerInfo customer) -
getCustId
public long getCustId() -
getId
public long getId()Synonym for getCustId() -
setName
Sets the name for this model -
getName
Returns the name of this model -
step
public abstract void step()Called to run the model forward one step. -
createTariffEvaluator
Creates a TariffEvaluator, populated with a pre-configured TariffEvaluationHelper. -
evaluateTariffs
Called to evaluate tariffs. -
lastSunday
protected org.joda.time.Instant lastSunday() -
startOfDay
protected org.joda.time.Instant startOfDay() -
nextStartOfDay
protected org.joda.time.Instant nextStartOfDay() -
setTariffMarket
-
changeSubscription
public void changeSubscription(org.powertac.common.Tariff tariff, org.powertac.common.Tariff newTariff, org.powertac.common.CustomerInfo customer)In this overloaded implementation of the changing subscription function, Here we just put the tariff we want to change and the whole population is moved to another random tariff. NOTE: Used only for testing...- Parameters:
tariff-
-