Pirasa: strategic protocol selection for e-commerce agents

We present Pirasa: an agent-based simulation environment for studying how autonomous agents can best interact with each other to exchange goods in e-commerce marketplaces. A marketplace in Pirasa enables agents to enact buyer or seller roles and select from sales, auction, and negotiation protocols to achieve the individual goals of their users. An agent’s strategy to maximize its utility in the marketplace is guided by its user’s preferences and constraints such as ‘maximum price’ and ‘deadline’, as well as an agent’s personality attributes, e.g., how ‘eager’ or ‘late’ the agent can be for exchanging goods and whether the agent is a ‘spender’ or ‘saver’ in an exchange. To guide the agent’s actions selected by a strategy, we use the notion of electronic contracts formulated as regulatory norms. In this context, we present how Pirasa is organized with regards to seller processes for goods submission, the inclusion of buyer preferences, and the management of transactions through specialized broker agents. Using randomized simulations, we demonstrate how a buyer agent can strategically select the most suitable protocol to satisfy its user’s preferences, goals and constraints in dynamically changing market settings. The generated simulation data can be leveraged by researchers to analyze agent behaviors, and develop additional strategies.


Introduction
The evolution of the Internet has brought about new standard procedures for purchasing goods online using Web browsers or mobile applications (Alt and Zimmermann 2016;Spiekermann et al. 2015). Using these procedures, referred to commonly as protocols, users can bid on items they would like to buy in auctions, they can negotiate with the sellers directly to get the best possible price, and they can order at a fixed price to get the item quickly. Since there are many alternative forms of such protocols to choose from, it is important that users can strategically select the best one for their needs.
Consider the following scenario. Bob wants to buy a present for his father as father's day is approaching. He has a watch in mind that he thinks his father would like. He goes online, searches for potential sellers and finds two: One has the watch in stock and provides a direct sales protocol for purchasing the watch at the standard price for next-day delivery, whereas the other provides an auction protocol which allows for buying the watch at a much lower price but it could potentially take much longer time to complete. Given the time constraint Bob has due to father's day, he decides to purchase the watch from the first seller, using the direct sales protocol.
It is becoming increasingly common for virtual assistant systems such as 'Amazon Echo ' and 'Google Home' to We propose to perform strategic protocol selection via simulations. Once presented with a set of alternative purchase protocols and market options, the buyer agent simulates its potential interactions in each available protocol and records its utility, which results in a ranking of the protocols. The multiagent simulation infrastructure of our framework relies upon the JADE agent platform (Bellifemine et al. 2000), on top of which we have provided a user interface to configure various properties of the simulation. PIRASA incorporates dynamic market elements and agent autonomy into the simulation environment. Design-time solutions such as model checking (Bataineh et al. 2017;Montali et al. 2014) fail to incorporate such autonomy, and can only verify whether an agent's goals comply with the protocol specification. To the best of our knowledge, this paper is the first attempt to tackle this problem from a run-time perspective.
Our contributions are as follows: • We provide a simulation framework for agent-based electronic commerce, where buyer agents interact with seller agents through broker agents. The broker agents regulate the interactions between the agents (formalized via regulatory norms) in the market. • We generate multiple seller behaviors using the available agent traits in the framework for three protocol types; direct sales, negotiation and auction. • We create multiple market settings, which reflect different levels of competitiveness and purchase options for the buyers, and simulate the buyer agents' strategies in those settings. We propose hypotheses on how buyer agents should behave in the presence of other buyers, and verify the hypotheses using buyer utilities gathered from the simulation data. • Other researchers can benefit from the generated simulation data to analyze buyer and seller behaviors, and develop additional strategies.

PIRASA structure and overview
Parallel to the growing of electronic markets, practical ecommerce systems need to adapt to end users' preferences.
To facilitate their construction, it is first necessary to develop a framework for the automated simulation, evaluation and comparison of strategies for the purchase of goods in markets with varying protocols. The problem domain discussed in this work is ecommerce agent-based market simulation, whose solutions are instances of practice-inspired research (Sein et al. 2011). The practice that motivates our work is online shopping. In current state of the art, human users visit a number of websites to choose the best buying option contain basic integration into e-commerce platforms in addition to their information retrieval capabilities. Although these systems have the capability to purchase items for a fixed price, they are unable to enact strategies for the acquisition of goods in e-commerce markets with varying protocols (e.g., Auctions). With recent advances in agent technology and machine learning, such personal agents should be able to make decisions on behalf of their users' goals, preferences and constraints. An agent should be able to search through available marketplaces for potential sellers, and determine which protocol would result in a purchase that meets the user's needs, possibly based on further interactions with other agents, whether human or artificial. The issue then becomes, if we had to build such an agent, how to determine in an electronic market which protocol is most suitable to best satisfy the specific user's needs.
We present PIRASA: An agent-based simulation framework that is designed to test different strategies in dynamic electronic marketplaces, and evaluate which protocol is the most preferable given the user's goals, preferences, and constraints. For example, an agent can be designed to help Bob choose the best protocol for purchasing a watch for his father. Such an agent should understand that Bob's time constraint is more important (since father's day is approaching) than the price of the watch. Therefore, the agent should decide to purchase the watch from the seller offering a direct sales protocol. However, if the watch offered by the direct sales protocol is significantly more expensive than purchasing the watch through an auction, then Bob's agent might reconsider its decision. Agents in PIRASA additionally have personality traits. For example, some buyers are eager to buy an item, whereas others prefer to save money when purchasing items online. Similarly, some sellers offer fast delivery times, whereas others offer good deals via flexible pricing options. Each seller also has a preferred sales type chosen among three general purchase protocols: direct sales, negotiation, and auction. PIRASA supports endless protocol configurations based on the protocol attributes, e.g. duration which determines the amount of time before the protocol terminates.
We use the notion of electronic contracts to regulate the interactions between the agents in a protocol, which are formalized via social norms represented as commitments, authorizations, and prohibitions (Singh 2013). Agent reasoning about norms is provided via the Event Calculus (Chesani et al. 2013;Kafalı and Yolum 2016). In our scenario above, Bob can check the delivery status of the watch via his contract with the seller. If something goes wrong and delivery is missed for father's day, the seller should commit to issuing a refund for Bob. A normative approach provides a high level of organizational flexibility, where the involved parties can create or cancel a norm, release it, or delegate it to others.
based on their needs. For example, if a user wants to buy a watch, that user can order it from "Amazon Prime" with "Next Day Delivery" option, or buy the same watch from an "eBay" auction for a lower price but with longer order processing time (e.g. wait for the auction to finish). Reasoning about the tradeoffs among such choices results in a loss of time for the user. Our proposal acts as a recommender system for automating this tedious process by using intelligent agents that know the preferences of their users. Specifically, we propose a framework, PIRASA, to support negotiation, auction, and purchasing protocols, and the capacity of agents to conduct strategies for optimising their users' market utilities.
To determine the necessary attributes of a system to solve this problem, we aimed to develop a system that could simulate the common protocols found in modern e-commerce markets with sufficient agents to simulate protocols in even the most crowded of markets (Akula and Menascé 2004). In order to motivate the agent's strategy, it is also necessary to imbue the agent with two key constraints that humans experience in traditional markets, i.e. time and cost.
"Technical background" reviews the technical background for PIRASA, and "PIRASA framework" describes the various components of its implementation. "Experiments" demonstrates our practical findings through simulation experiments, and discusses the potential integration of realworld e-commerce datasets to infer simulation parameters. Table 1 summarises the application stages of our use case, inspired by Action Design Research (ADR) methodology (Sein et al. 2011). We describe in detail the prototype implementation and evaluation stages of PIRASA in "PIRASA framework" and "Experiments"; respectively.
When comparing with existing work, a number of different criteria can be used, namely: (i) The capacity of the system to operate with large numbers of agents; (ii) the number of e-commerce protocols that can be simulated; (iii) the flexibility of agents to mirror the myriad constraints and preferences that influence human behaviour when operating in a market; and (iv) the ease with which new agent strategies can be constructed. PIRASA is designed with these criteria in mind, and is compared in "Related work" with the relevant literature on simulation environments and e-commerce platforms.

Technical background
In this section, we review the technical background that our simulation framework is built upon; electronic contracts and their formalization as regulatory norms, agent reasoning based in the Event Calculus, and the agent development platform JADE.

Electronic contracts and norms
A contract describes how the involved parties should act in a business dealing. We adopt social norms (Singh 2013) to formally represent electronic contracts. Norms (commitments, authorizations, and prohibitions) take their basis from deontic logic concepts (Von Wright 1999), and have been widely used in fields of artificial intelligence that deal with legal concepts (Boella and van der Torre 2008;Dechesne et al. 2013), compliance checking (Governatori 2013), and requirements engineering (Kafalı et al. 2016a).  Formally, a norm n(X, Y, antecedent, consequent) represents a social relationship between its subject (X) and object (Y) regarding its consequent when its antecedent holds. Here, n is the norm type (c for commitment, a for authorization, or p for prohibition), X and Y are agents, and the antecedent and the consequent are first-order logic predicates (either atomic propositions, or conjunctions or disjunctions of them). We model conditional, detached, satisfied, and violated norm states. Figure 1 describes the lifecycle of norms (Kafalı et al. 2016b). A conditional norm is detached when its antecedent holds. Satisfaction and violation conditions are described according to the norm type.
In this paper, we mainly adopt the commitment norm as the basis for representing electronic contracts. Commitments have previously been used in e-commerce (Kafalı and Torroni 2012;Kafalı and Yolum 2016). Consider the following commitment: c(store, customer, payment, delivery) (1) The above commitment is a conditional commitment; if the antecedent (payment) is satisfied, then the subject (store) becomes committed to the object (customer) for satisfying the consequent (delivery), and the commitment becomes detached. A base-level commitment is simply a commitment with its antecedent condition being true. If the consequent is satisfied, the commitment is satisfied. After the commitment is detached, if the consequent is not satisfied, the commitment is violated.

Event calculus
Event Calculus (EC) (Kowalski and Sergot 1986) is an extension of first-order logic to interpret and reason about events in time. Table 2 summarizes the domain-independent axioms of EC. Predicate happens records events with the time points of their occurrence. Predicate initially specifies fluents that hold initially. Predicate holds at queries the happened events to check whether a fluent holds at a specified time point. Predicate initiates marks that an event initiates a fluent at a specified time point. Predicate broken checks whether a fluent is terminated during a time period.
Predicate terminates marks that an event terminates a fluent at a specified time point.
We adopt the Reactive Event Calculus (REC) (Chesani et al. 2013) as a logic programming tool that extends EC for run-time monitoring. The REC engine takes as input (i) a normative theory shared amongst all agents that describes how norms change state; (ii) a protocol description specific to each individual agent that describes the domain, e.g., consequences of the agents' actions as well as any known facts; and (iii) a narrative specific to each individual agent that contains the events performed through the evolution of time.
Listing 1 demonstrates a sample narrative in EC. According to the recorded events, the customer has paid for the item at time 4, the store has processed the order at time 5, and the courier has delivered the item at time 7. Like protocol descriptions, event traces are agent-dependent. That is, each agent is aware of only the events that are relevant, but does not see the events that might have happened for other agents.
Once the REC engine is run with the above input, it produces an outcome that demonstrates the fluents the agent is aware of through time (e.g., states of commitments). REC can be extended with additional functionality besides commitment tracking such as exception handling behavior (Kafalı and Torroni 2012;Kafalı 2012).

JADE platform
Agent-Based simulation is a widely adopted technique in distributed artificial intelligence to analyze agent behaviors and strategies. Amongst many agent development and simulation environments, we adopt JADE (Bellifemine et al. 2000) to develop our agents as it provides reliable agent communication and documentation support. Moreover, despite the existence of a number of other Java agent development platforms (Luke et al. 2004;Baumer et al. 1999;Xu and Shatz 2003), JADE is actively maintained and compliant to the FIPA 1 agent standard. JADE provides a library of Java classes to develop agent strategies as well as graphical interfaces to configure and run simulations. JADE supports asynchronous messaging for agent communication, and provides yellow pages for publish & subscribe type services to simulate electronic markets.

PIRASA framework
E-commerce transactions in the real world such as listing and purchasing of items are simplified for buyers and sellers on sites such as Amazon and eBay by acting as a hub between the agents. We propose to mimic such transactions on the web by adding "broker" agents in addition to the sheer number of potential buyers and sellers. The inclusion of brokers simplifies the process of a potential buyer finding a seller, and therefore both increases the throughput of the system, while minimizing the amount of time an agent is actively looking for a new transaction. We adopt the electronic contract framework proposed by Wood et al. (2013) and extend it to reflect the architecture shown in Fig. 2.

Agents and transactions
PIRASA supports three types of agents: sellers, buyers, and brokers.
(i) Sellers and product submission: At the beginning of a simulation, broker agents solicit the seller agents to publish all items they want to sell through the broker in the form of services. In order for a seller to submit their item for sale to a broker, the seller first locates all brokers and then sends each one a message asking them to host the item. This seller protocol is shown in Fig. 3. Each broker replies either rejecting the proposal, or returning a potential protocol with which to host the item. The seller can then select the protocol which best suits its goal, e.g., whether they want to maximize profit or prefer a quick transaction. At this point, a message of confirmation containing details about the item is sent to the preferred broker. The broker then replies with a confirmation of receipt, and instantiates an unactivated service. Potential buyers can now attempt to obtain the item, which triggers the activation of the service, starting the count down to its termination. (ii) Buyers and user preferences: The formulation of buyer agents' goals enables constraints to be placed on how a buyer goes about obtaining items. A goal can currently be constrained by a time limit, a price limit, or both. For example, if an agent has a time constraint (i.e., deadline) for an item and there is an auction which will only end after the time constraint has been violated, then the buyer will ignore it. However, a buyer will not make any assumptions with regards to the total duration of a negotiation, as it is possible at any point for the seller to accept an offer, and end the negotiation. PIRASA currently supports the following four attributes for buyers: • Eagerness: The propensity of an agent to place a high urgency on a transaction. A high eagerness modifier results in agents aiming for the quickest transactions possible. • Lateness: The propensity of an agent to place a low urgency on a transaction. • Spending: The propensity for an agent to enter into monetarily unfavorable transactions in exchange for eagerness. • Saving: The propensity for an agent to enter only into highly favorable transactions.
(iii) Brokers and market transactions: Buyers initiate market interactions by requesting all broker agents for services which match their goals (see Fig. 2). Upon perceiving the services available, a buyer strategically determines the best service to subscribe to, in accordance with its personality traits. Depending on the nature of the service, upon the receipt of a new offer from a buyer, the broker enforces the rules of the protocol in terms of a set of norms. If accepted, the buyer engages in a contract with the seller to receive the item in the allotted time. Buyer agents are affected by two factors when reasoning on a service. Their personality traits either increase or decrease their tolerance of higher prices or service durations. Their goals enforce constraints over the cost and duration of possible services.

Predefined protocols
A protocol in PIRASA is defined as a seven-tuple containing two integers and five boolean variables (described in detail in "Custom protocols"), which represent fundamental parameters of real world transaction protocols. The protocol description acts as a blueprint for the creation of a service, which in turn is the construct that actually handles offers from the buyer agents, and establishes norms among the buyer and seller agents. PIRASA supports three predefined protocols.
(i) Direct sales: A direct sales protocol is the simplest common method of transaction. A buyer offers the broker the asking price for the item and the protocol completes immediately. The protocol results in an item being sold for the market price with little time spent (not taking into account delivery times). Direct sales is favored by agents that have personalities with a high "eagerness" value. The below conditional commitment is created between the buyer and seller.
c(seller, buyer, payment, delivery) When the seller is notified of payment, it is committed to ensuring the delivery of the item. The progression of commitment states is handled by each agent's REC engine. Note that the commitment theory is not the focus of this paper. However, we still record the number of commitment violations per agent as part of our simulation data. (ii) Auction: An auction is defined as an interaction between any number of buyers and a single seller that lasts for a predetermined time, mediated by a broker. Technically, the auction is regarded as a single-item, first-price, open-cry, ascending auction (Parsons et al. 2011;Harris and Raviv 1981). An auction is started as soon as the seller accepts the proposal from the broker to host it, and during its lifecycle the broker receives bids from any buyer agent. The broker does not interact with the seller during this time, and therefore can accept or reject an offer based on whether or not the offering agent has violated any norms. Once a buyer has its offer accepted by the broker, the following norms are created amongst the buyer, seller, and broker.
Norm 3 states that all buyers are authorized to make bids on the auctioned item. Norm 4 states that the buyer with the highest bid is committed to sending the payment to the seller. This commitment ensures that there is no way for a buyer to retract a bid (that has not been outbid) without violating their commitment. Norm 5 is the same commitment from the direct sales protocol (Norm 2) that handles delivery of the item once it is paid for. (iii) Negotiation: A negotiation protocol is somewhat similar to the auction protocol outlined above, in that it is better for the buyer when it is not competing with others for an item, otherwise it is advantageous for the seller. The negotiation architecture is demonstrated in Fig. 3. Since the seller has control over whether or not it will accept an offer, it can make counteroffers to buyers which will result in the item being sold below its market value, or alternatively the seller can wait for a long time to receive a higher offer by rejecting all lower offers. Certainly, this is a riskier strategy, because if a seller overvalues their item, it could result in no sale being made at all. In PIRASA, the propensity for sellers to adopt such strategies is based on their personalities, which are determined by attributes such as greed and eagerness.
Norm 6 states that the buyer is authorized to make an offer if its previous offer is rejected by the seller. Norm 7 states that the buyer is committed to sending the payment to the seller if the offer is accepted. Norm 8 is the same commitment from the direct sales protocol (Norm 2) that handles delivery of the item once it is paid for.

Custom protocols
It is crucial for market designers to customize the protocols available in their market place to attract a variety of buyers and sellers. In addition to the predefined protocols, PIRASA supports the creation of new protocols via customization of protocol attributes. The attributes of a service encapsulating a protocol are the following: • Max clients: The maximum number of buyers which can subscribe to the service. In the case of an an auction, for example, there would be no limit, but for a sale, the maximum number would be one. • Max length: The maximum number of time steps that the service lasts. In the case of an auction, it would be a finite number, whereas for a negotiation it would be infinite, as a negotiation lasts as long as the two parties want it to before the transaction is finalized. • Seller involvement: Whether the broker is authorized to make decisions on the seller's behalf. For example, if during a negotiation the broker can accept an offer made by the buyer, or whether they have to forward the message to the seller for approval. • Alternating offers: Whether the seller is authorized to make counter offers to the buyer. Used exclusively with seller involvement. • Buyer informed: Whether the broker informs buyers when they are outbid. • Activate immediately: Whether a service is activated immediately, or whether it is activated when a bid has first been placed on it. • One offer per buyer: Whether a buyer is authorized to have more that one outstanding offer on a service.
These attributes enable a variety of protocols to be formulated, including direct sales, auctions, and negotiations. When looking for a particular item, buyers look for a protocol for that specific item. They can either activate a dormant service, or join a running one (assuming that the maxclients variable is greater than than the number of agents the have already placed offers). A protocol is initially created dormant, with no buyers subscribed to it. As soon as the first buyer subscribes, the protocol is activated and it exists only for as long as its max length is not surpassed. A protocol can also be automatically started when the broker starts to host it.

Experimental design
To highlight the use of PIRASA, we construct a set of experiments to test the individual utility of several buyer agents. Each experiment is repeated 100 times with the average utility being measured and compared amongst buyers. The utility metric identifies the effectiveness of buyer agents, which corresponds to the goal completion rate of buyers. Naturally, this metric is most useful for simulations in which there are fewer number of sellers.

Buyers:
We describe three buyer personalities with the following parameters: • EagerSaver: agents have eager and saver traits of 0.7.
• EagerSpender: agents have eager and spend traits of 0.9 and 0.7, respectively. • Saver: agents have eager and saver traits of 0.4 and 0.9, respectively.

Sellers & Protocols:
In our experiments sellers are described by the protocols that they support in order to sell their goods.
• Sales-allows sellers to sell goods at a fixed price; • Auction-lets the market of buyers determine the price of goods; and • Negotiation-supports sellers to negotiate with buyers the price of goods.
In Table 3 we show how the protocols compare with one another. In addition to the creation of the above scenarios, we capture data from human users in historical Ebay auctions Shmueli 2010, 2017), specifically the auctions of Cartier watches that lasted 7 days. We transform this data to agent traits and constraints, enabling the simulation and permutation of historical auctions, for the purpose of evaluating whether historical outcomes could be improved. From historical bids, we normalise the bid price and bid time, deriving the proportion of an auction that has elapsed, and the proportion of the end price that has been achieved at every bid. We then regress bid time against bid price for each bidder, and capture the resultant parameters as 'Eager' and 'Spender/Saver' traits for each participant in the auction, applying 'Max Price' constraints derived from the maximum bid that each user made. The above development is reflected in the following subsections, where we describe our simulations and results.
We applied simulated annealing to derive the agent attributes, implemented using the Opt4j library (Lukasiewycz et al. 2011). Our goal is to determine the optimal parameters for each agent in a PIRASA simulation, such that the output bid ordering is the same as an equivalent historical auction -thus demonstrating that PIRASA is able to simulate the dynamics of historical auctions, with few parameters. Formally, given a simulation with n agents (n ≥ 2), our aim is to minimise f (o, h), the mean-square of the differences of indices of each element between o and h, where o is the output of a PIRASA run; a sequence of bids o = {o 1 , o 2 , ..., o n }, and h is the sequences of bids from a historical auction or negotiation h = {h 1 , h 2 , ..., h n }. We randomly initialise a set of parameter vectors, representing Eagerness (e), Lateness (l), Spender (sp) and Saver (sa). We sample the output from a PIRASA run, determined by these parameters, and generate a fitness value from the mean-square differences, with which we can continue annealing.
For each of the three experiments, we reran the annealing to estimate the optimal parameters for that scenario. As we are not attempting to learn a generalisable function of PIRASA, but rather learn the best parameters for a given auction, over-fitting did not present an issue.

Simulations
For all experiments, we simulate the selected buyers in all three protocols and report the average utilities. Moreover, we state our hypotheses informally, and investigate whether they hold.
Simulation 1: We examine a buyer agent with an "EagerSaver" personality. There are no other buyer agents (as competitors) in this setting.
Hypothesis 1: We expect the agent to prefer faster (due to eager) and cheaper (due to saver) services. Therefore, we anticipate that the agent would gain higher utility in either direct sales or negotiation protocols. Since there is no competition from other buyers, the simulations should result in a low mean spend for the agent. Simulation 2: We examine two buyer agents with "EagerSaver" and "EagerSpender" personalities. Hypothesis 2: Since the EagerSpender agent has a higher propensity to spend, and is more eager than the EagerSaver agent, we expect the EagerSpender agent to out-compete the EagerSaver agent in instances where both agents attempt to bid in the same service. Moreover, since the EagerSpender agent does not care about the price of an item, we anticipate that it would gain higher utility in direct sales protocols. Simulation 3: We examine three buyer agents with all three personalities; "EagerSaver", "EagerSpender", "Saver". Hypothesis 3: We expect the Saver agent to only bid when the service price is low and therefore to remain dormant unless a service exists in the market with an item price low enough to entice the agent. We anticipate that the Saver agent would be out-competed in cases where it shares a protocol with other buyer agents (as competitors), and therefore have the lowest utility amongst other buyers. Simulations 4-7: We extract traits from four historical Ebay auctions whose dynamics are illustrated in Fig. 7. We use these traits to construct four auction-only settings composed of three to five buyer agents. Hypotheses 4-7: We expect the bidding dynamics of the simulated agents to closely correspond to the dynamics of human bidders in the historical auctions, where the bids being placed reflect the historical trend.

Results
Below, we summarize our main observations about the first three simulations, and compare them with our initial hypotheses. Fig. 4 The stacked mean utility for EagerSaver in Simulation 1 No competition: In Simulation 1, where there are no competing buyers, we observe via Fig. 4 that the EagerSaver agent maintains a mean utility of one, as in each run it has three possible services to choose from with no competition. As compatible with our hypothesis, it chooses direct sales and negotiation protocols more often than auctions. Spend vs save: In Simulation 2, we have two competing buyers (EagerSaver and EagerSpender), which are both more likely to choose direct sales and negotiation protocols than Auctions. However, since EagerSpender can spend more and is highly eager in nature, we observe via Fig. 5 that it out-competes EagerSaver in almost all direct sale protocols, forcing the EagerSaver agent to fulfill its goal mainly through negotiation and auction protocols (compatible with our hypothesis). This competition results in both agents ending the simulation with high, albeit suboptimal utility. Effect of competition: In Simulation 3, we have all three buyer personalities in the same environment. The Saver agent is far less likely to spend money in pursuit of its goals, and is therefore more timorous than the other two agents. We observe via Fig. 6 that there is significant competition between the agents, driving down the overall utilities of all agents. Surprisingly and in contrary to our initial hypothesis, the Saver agent maintains a higher mean utility than the EagerSaver agent. This is possibly due to the agent being less likely to compete in direct sales protocols against the EagerSpender agent, and instead going for negotiation protocols. This is a different strategy than what the EagerSaver agent adopts. The EagerSaver agent (unsuccessfully) attempts to compete with EagerSpender on direct sale protocols. The above results support our hypotheses that the agents with high "Spend" and "Eager" modifiers have the highest utility, and generally out-compete agents with "Save" modifiers in markets with a fixed number of protocols and agents. Moreover, we observe that competition (the inclusion of other buyers in the market) impacts the utility of buyers in closed market environments, resulting in a change of utility from 1.0 to 0.76 from Simulation 1 to Simulation 3. Historical data: In Simulations 4-7, we find that capturing the 'Eagerness', 'Spending', and 'Saving' attributes of agents and using the 'Max Cost' constraints from bid history are sufficient to replicate the dynamics of four historical Ebay auctions (Jank and Shmueli 2017). A comparison of Figs. 7 (real auction data) and 8 (agent-based simulations) shows that our simulated buyer agents make bids that closely mimic those placed by their human counterparts. Moreover, due to the autonomy associated with agent behaviours, some agent bids show deviations from mined data, which would enable e-commerce researchers to simulate settings with varying market dynamics. Further experimentation in this direction would improve the prediction of bidding behavior in online auctions using human-based historical data, and enable the development of more sophisticated agents.

Performance evaluation
We evaluate the performance of PIRASA through a series of experiments with numbers of agents ranging from 50 to 500, incrementing by 50. We run these experiments on an i7 4770k computer with 16gb of memory running Windows 7 64-bit OS. For each experiment we run 3 sets of 10 simulation runs with an equal number of buyers and sellers, finding the average time taken for 10 runs to elapse. We then derive from this the average length of a single run. One can see from Fig. 9a that there is a linear increase in the simulation time, up until 350 agents. This number of agents is quite significant compared to other e-commerce  We run a similar performance evaluation for RECON (Alrayes et al. 2016). Figure 9b shows that the average cycle time for buyer agents in RECON grow linearly over 100 runs with increasing numbers of agents. Although the simulation settings in PIRASA and RECON vary, we can see by comparison of two plots that PIRASA can support a fairly large number of concurrent agents to simulate e-commerce protocols. Moreover, note that PIRASA can support multiple protocols whereas RECON is specifically built for negotiation protocols.

Related work
In this section, we review relevant literature on agent-based simulation environments and e-commerce platforms, and compare their contributions to PIRASA.
There has been extensive research in recent years into agent negotiation in the context of marketplace simulation, usually with a focus on negotiation strategies. The e-Game (electronic Generic auction marketplace) platform (Fasli and Michalakopoulos 2008) is a Java based, FIPA compliant platform that shares many similarities with PIRASA. Built for simulations into market infrastructure, Fig. 9 Performance with increasing numbers of agents negotiation protocols, and strategic behavior, it supports complex and dynamic auctions, facilitated by a scheduler agent, which is roughly analogous to the broker agent in PIRASA. However, e-Game does not just provide facilities for scheduling, running and conducting experiments, but enables modular implementation of auction-based market simulations. The development of new simulations in e-Game is tedious, requiring several thousand lines of code for a simple market scenario.
Another attempt at automatic agent negotiation in the context of auctions is the work of Benameur et al. (Benameur et al. 2002), which considers a market setting with: (i) one vendor (seller) and one buyer directly negotiating; (ii) multiple vendors and one buyer are engaged in a reverse auction; (iii) multiple buyers and one vendor are engaged in a classical auction; (iv) multiple buyers and vendors trade in a market. Their approach differs from ours as they do not include broker agents, instead letting the vendors manage the auctions themselves. Since they do not rely on a third party agent, their auction model is generic enough to simulate each instance of their market framework. However, their implementation assumes that agents interact in accordance with the English auction protocol (openoutcry ascending) (Wooldridge 2009), which is a major limitation when simulating complex market scenarios. As a result, one-to-one bargaining could not be simulated.
Multiagent negotiation platforms are proposed to implement and analyze automated agent strategies for negotiation. The eAgora platform (Chen et al. 2005) is an emarketplace constructed for the simulation of multi-issue negotiations (a setting that cannot be easily modeled with auctions), where either the buyer or the seller can be the host. This is a difference from PIRASA. In addition, eAgora represents agent negotiation strategies as either competitive, collaborative, compromising, or accommodating, which loosely corresponds with the attributes of 'saver' and 'spender' (with different proportional values) in PIRASA. However, only the above four strategies are supported, which is a limitation when compared to the adaptive nature of the infinitely many strategies that can be constructed in PIRASA.
GENIUS (Lin et al. 2014) is a negotiation environment that implements an open architecture for heterogeneous negotiating agents. It provides a testbed for negotiating agents that includes a set of negotiation problems for benchmarking agents, a library of negotiation strategies, and analytical tools to evaluate an agent's performance. GENIUS is mainly used for evaluating bilateral negotiations, especially for agents participating in the automated negotiating agents competition (ANAC) (Fujita et al. 2013). Williams et al. extended GENIUS to provide support for concurrent negotiations (Williams et al. 2012). However, this extension addresses a specific experimental setup, and is not publicly accessible. Moreover, we are not aware of any work that evaluates the robustness and scalability of GENIUS when using a large number of agents.
Motivated by the current limitations in GENIUS, RECON (Alrayes et al. 2016) was developed as a robust multiagent environment for simulating concurrent negotiations. RECON has been built on top of the GOLEM agent platform (Bromuri and Stathis 2008), and supports the development of software agents (both buyers and sellers) negotiating concurrently with other agents over multiple issues. In contrast to most agent development platforms such as GENIUS, which only support imperative agents built in Java, RECON supports agents developed with declarative logic programs. Declarative agents enable developers to specify strategies that can be transparent to a human user, in that explanations can be provided for describing why the agent has taken certain actions during a negotiation.
There are many commercial negotiation simulation environments in the market (Sim 2002): Tete-a-Tete, Kasbah, AuctionBot, and the Fisher market. Fisher market is based on the Dutch auction protocol. The limitation with the Dutch auction is when there is one seller then the auctioneer will sell the product for the seller if the buyer reservation price has not yet reached. Whereas, PIRASA supports many protocol types depending on how many sellers and buyers are in the market, and whether the goals of the seller and buyer are to maximize profit or to prefer a quick transaction. AuctionBot supports many auction types including the Dutch auction. The same limitation for Fisher market applies to AuctionBot, it is not suitable when the sellers want to negotiate quickly or if there is one agent in the market. On the other hand, Tete-a-Tete and Kasbah offers one kind of negotiation protocol, whereas PIRASA offers three kind of protocols, which can further be customised and extended. One novelty that PIRASA provides is that we are not limited to one type of protocol. A variety of protocols, including Dutch auctions, can be integrated into PIRASA using the customizable protocol attributes, as well as adding new attributes.

Conclusions and future work
In this paper, we have presented PIRASA: an agent-based platform for simulating e-commerce protocols. It allows agents to determine which protocol is more beneficial via experimentation in different settings. It supports customization of agent attributes, which govern the agent's behavior. This enables to simulate realistic e-markets where buyers compete with other to buy items from seller. Our attempt is a first to do this in real-time.
PIRASA supports basic goals and constraints for the agents, e.g., a deadline to purchase a specific item. Future work could result in hierarchical trees of predicates to allow agents to retain highly complex goals. Goals could also be extended to be domain specific, conforming to a predefined ontology. In the current framework, we have focused on buyers and have not implemented complicated seller strategies. Having goals for the sellers as well would lead to more realistic e-markets.
Having a depreciation or appreciation modifier for items would add a new layer into PIRASA, as it would allow buyers to be more strategic when choosing services to bid on, i.e., a Saver agent could choose to fulfill a goal with a lower quality yet cheaper item, as opposed to spending more for a better item. This would also tie into seller strategy, as the quality of an item could partially dictate the protocol they use with which to sell it. For example, when trying to sell a slightly depreciated item, such as a car which has had a previous owner, there is a greater scope for negotiation. Similarly, low quality items, such as an old sofa, could either be negotiated or auctioned.
There might be other protocol types that can be supported by modifying the protocol parameters. A Dutch auction (also known as a clock auction or an open-outcry descending-price auction) is the idea that a seller tries to sell an item at a very high price, and slowly over time lowers that price until some buyer is willing to pay and obtain the item. This is referred to as an auction because it tends to provide the market ceiling price for a seller.
We plan to extend our work in the following directions: • We have evaluated protocols from the buyer's point of view. In a more realistic setting, a trader agent might act both as a buyer and a seller in multiple competitive markets. Investigation of such markets, as well as taking into account the violations of agents' norms, can help understand how metrics such as social welfare evolve in those markets. • Performing statistical tests and understanding the connection between agent traits and protocol properties more closely would be helpful to determine whether a protocol is significantly more beneficial to an agent over the others. • PIRASA can be extended to include additional multiagent protocols such as argumentation (Gao et al. 2016;Kökciyan et al. 2017) for resolving conflicts among trading agents as well as between agents and their users. Such agents should learn from previous encounters with other agents as well as take into account user's feedback on previous choices. Whereas such interactions are helpful among the agent and its user, they introduce privacy concerns, e.g., what amount of information should users share with their agents to maximize their utilities, and how would this information propagate in the market? In its current form, an agent in PIRASA does not reveal its users' preferences to other agents. The agent only simulates the potential interactions as they would be observed in a real transaction. Agent-based privacy solutions (Baarslag et al. 2017;Kafalı et al. 2016a) can be employed to address information disclosure concerns when the agent interacts with other agents as well as its user. • PIRASA can be extended to enable the participation of human agents as part of the simulations to capture more realistic e-commerce settings. Such humans agents would not be autonomous, and would simply follow orders from a human operator. Crowdsourcing studies can be conducted to evaluate the interactions among intelligent agents and human users.
Open Access This article is distributed under the terms of the Creative Commons Attribution 4.0 International License (http:// creativecommons.org/licenses/by/4.0/), which permits unrestricted use, distribution, and reproduction in any medium, provided you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license, and indicate if changes were made.