Skip to content

Configuring behavior

John Collins edited this page Aug 2, 2023 · 4 revisions

Configuring the behavior of the Sample Broker

As of the 1.9.0 release, the broker design offers some basic parameter configuration. If the Sample Broker is to become a useful tool for experiments, it needs to be more configurable, in order to allow treatments to be distinguished by configuration rather than by code versions as was done with the MinneTAC system.

Configuring the timing and details of offered tariffs

The 1.9.0 broker contains a method PortfolioManagerService.improveTariffs() in which new hardcoded tariffs are offered at hardcoded times during a sim run. So if we want to configure this behavior, we would need to specify timing and content of multiple tariff offerings in a configuration file.

There are two features that could be used to make this work. First, configuration can be applied to an element using three methods in common.config.Configurator. The simplest is configureSingleton(Object) which configures a single instance and does not expect to see a name property in that instance. The entry in a configuration file used by this method looks like

class.property = string

where the classname may omit the org.powertac prefix. So for example the timeslot duration for a boot session is set in CompetitionControlService with

server.competitionControlService.bootstrapTimeslotMillis = 400

If we want to use configuration to instantiate and configure a number of instances, we use configureInstances(type). In the confiration file, this requires a list of instance names, followed by entries of the form

class.name.property = string

So how might we use this capability to specify tariffs to be offered by the sample broker? We already have a way to convert a string to a TariffSpecification. TariffSpecification instances are communicated to the server and back to competing brokers in XML format, converted to and from XML using XStream. They are recorded in the sample broker's trace log. So if we define a simple class that holds a name, a timeslot number, and a string, we could configure instances of this class. Then the broker would need to sort this list by timeslot and convert the XML to TariffSpecification instances as needed, offering the tariffs at the given timeslots.