ScalABM / auctions

A functional API for auction simulations
Apache License 2.0
13 stars 1 forks source link

First draft of the combineWith method for auctions. #111

Closed davidrpugh closed 7 years ago

davidrpugh commented 7 years ago

This PR adds a combineWith method to the Auction type that effectively merges an auction with another auction of an appropriate type. This method will be used to parallelize auction simulations as follows.

val orders: ParIterable[(Token, Order[T])] = ???
val withOutOrders: Auction = ???
val withOrders: Auction = orders.aggregate(withOutOrders)((auction, order) => auction.insert(order), (auction1, auction2) => auction1.combineWith(auction2))

The real work is being done by the aggregate method which is part of the scala collections library. Finalizing this PR requires implementing some helper methods in the FourHeapOrderBook class and addressing an issue with the visibility modifier on the orderBook field in the Auction type.