Database Reference
In-Depth Information
Agent Types
Similar to AgentSettings , each class representing a type of agents extends Agent .
For example, the general class of price optimization agents is PricingAgent which
extends Agent . This is the agent class associated with PricingAgentSettings .
Along with all agent settings, XELOPES provides the associated agent classes
containing the basic implementations.
Example 12.17 We give a (simplified) example of price optimization using an
agent which calculates the optimal prices of products. The transaction data is
contained in a CSV file whose path is specified in TRANSACT_FILE . For each
transaction product, the agent calculates the optimal price, and based on the
resulting orders (or not order), the agent learns. The resulting elasticity agent is
written to the PMML file LinElastAgent.xml.
// Open data source and get metadata:
MiningInputStream
inputData ¼ new
MiningCsvStream(
TRANSACT_FILE );
inputData.open();
MiningDataSpecification metaData ¼ inputData.getMetaData
();
// Create AgentSettings object:
PricingAgentSettings settings ¼ new PricingAgentSettings
();
settings.setInputDataSpecification( metaData );
settings.setUseRoundPrice(true);
settings.setRoundPriceRule(1.2, 0.25, 0.98);
settings.setRoundPriceRule(1.3, 0.25, 0.98);
settings.verifySettings();
// Get agent specification from 'agents.xml':
AgentSpecification agentSpecification ¼
AgentSpecification.getAgentSpecification(
"LinElastAgent" );
// Set agent parameters:
agentSpecification.setAPValue("explorationRate ", 0.1);
agentSpecification.setAPValue("priceEpsilon", 0.02);
agentSpecification.setAPValue("movingAverageTurno-
verRange", 1.0);
// Create agent object:
PricingAgent agent ¼ (PricingAgent) agentSpecification.
createAgentInstance();
// Create environment object:
EnvironmentInformation env ¼ getPoEnvironment(); // not
shown here
Search WWH ::




Custom Search