|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.cuny.cat.market.AuctioneerPolicy
edu.cuny.cat.market.matching.ShoutEngine
edu.cuny.cat.market.matching.LazyMaxVolumeShoutEngine
public class LazyMaxVolumeShoutEngine
This class provides a matching policy that differs from
FourHeapShoutEngine
in the sense that it maximizes the matching
quantity by pairing high intra-marginal shouts with extra-marginal shouts.
Due to performance consideration, this engine does not maintain a matched set of shouts for the moment.
Field Summary | |
---|---|
protected edu.cuny.struct.SortedTreeList<Shout> |
asks
asks in ascending order |
protected edu.cuny.struct.SortedTreeList<Shout> |
bids
bids in ascending order |
protected edu.cuny.struct.SortedTreeList<Shout> |
bIn
Matched bids in ascending order |
protected edu.cuny.struct.SortedTreeList<Shout> |
bOut
Unmatched bids in ascending order |
protected int |
matchingVolume
the matching quantity with the current supply and demand |
protected edu.cuny.struct.SortedTreeList<Shout> |
sIn
Matched asks in ascending order |
protected edu.cuny.struct.SortedTreeList<Shout> |
sOut
Unmatched asks in ascending order |
protected edu.cuny.random.Uniform |
uniform
used to randomize the order of matching pairs of shouts |
Fields inherited from class edu.cuny.cat.market.matching.ShoutEngine |
---|
AscendingOrder, DescendingOrder |
Fields inherited from class edu.cuny.cat.market.AuctioneerPolicy |
---|
auctioneer |
Constructor Summary | |
---|---|
LazyMaxVolumeShoutEngine()
|
Method Summary | |
---|---|
java.util.Iterator<Shout> |
ascendingAskIterator()
|
java.util.Iterator<Shout> |
askIterator()
|
java.util.Iterator<Shout> |
bidIterator()
|
int |
calculateMatchingQuantity()
|
java.util.Iterator<Shout> |
descendingBidIterator()
|
protected void |
distributeShouts(int quantity,
edu.cuny.struct.SortedTreeList<Shout> list,
edu.cuny.struct.SortedTreeList<Shout> in,
edu.cuny.struct.SortedTreeList<Shout> out,
boolean fromTail)
|
protected void |
distributeShoutsFromHead(int quantity,
edu.cuny.struct.SortedTreeList<Shout> list,
edu.cuny.struct.SortedTreeList<Shout> in,
edu.cuny.struct.SortedTreeList<Shout> out)
|
protected void |
distributeShoutsFromTail(int quantity,
edu.cuny.struct.SortedTreeList<Shout> list,
edu.cuny.struct.SortedTreeList<Shout> in,
edu.cuny.struct.SortedTreeList<Shout> out)
|
Shout |
getHighestMatchedAsk()
Get the highest matched ask. |
Shout |
getHighestUnmatchedBid()
Get the highest unmatched bid in the auction. |
Shout |
getLowestMatchedBid()
Get the lowest matched bid in the auction. |
Shout |
getLowestUnmatchedAsk()
Get the lowest unmatched ask. |
org.apache.commons.collections15.buffer.PriorityBuffer<Shout> |
getMatchedAsks()
|
org.apache.commons.collections15.buffer.PriorityBuffer<Shout> |
getMatchedBids()
|
int |
getMatchedVolume()
|
int |
getNumOfMatchedAsks()
|
int |
getNumOfMatchedBids()
|
int |
getNumOfUnmatchedAsks()
|
int |
getNumOfUnmatchedBids()
|
org.apache.commons.collections15.buffer.PriorityBuffer<Shout> |
getUnmatchedAsks()
|
org.apache.commons.collections15.buffer.PriorityBuffer<Shout> |
getUnmatchedBids()
|
int |
getUnmatchedDemand()
|
int |
getUnmatchedSupply()
|
java.util.Iterator<Shout> |
matchedAskIterator()
|
java.util.Iterator<Shout> |
matchedBidIterator()
|
java.util.List<Shout> |
matchShouts()
Return a list of matched bids and asks. |
void |
newShout(Shout shout)
|
void |
prettyPrint(java.lang.String title,
java.util.List<Shout> shouts)
|
void |
printState()
Log the current status of the auction. |
protected void |
randomizeMatches(java.util.List<Shout> result)
randomizes the bid-ask pairs in the given list. |
void |
removeShout(Shout shout)
|
void |
reset()
resets the state to be the same as the policy is created and initialized. |
java.lang.String |
toString()
|
protected void |
updateMatchedShouts()
|
Methods inherited from class edu.cuny.cat.market.matching.ShoutEngine |
---|
getMatchedShouts |
Methods inherited from class edu.cuny.cat.market.AuctioneerPolicy |
---|
eventOccurred, getAuctioneer, initialize, setAuctioneer, setup |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected edu.cuny.struct.SortedTreeList<Shout> asks
protected edu.cuny.struct.SortedTreeList<Shout> bids
protected edu.cuny.struct.SortedTreeList<Shout> bIn
protected edu.cuny.struct.SortedTreeList<Shout> bOut
protected edu.cuny.struct.SortedTreeList<Shout> sIn
protected edu.cuny.struct.SortedTreeList<Shout> sOut
protected edu.cuny.random.Uniform uniform
protected int matchingVolume
Constructor Detail |
---|
public LazyMaxVolumeShoutEngine()
Method Detail |
---|
public void reset()
AuctioneerPolicy
reset
in interface edu.cuny.obj.Resetable
reset
in class AuctioneerPolicy
public void removeShout(Shout shout)
removeShout
in class ShoutEngine
public void newShout(Shout shout) throws DuplicateShoutException
newShout
in class ShoutEngine
DuplicateShoutException
protected void updateMatchedShouts()
protected void distributeShoutsFromTail(int quantity, edu.cuny.struct.SortedTreeList<Shout> list, edu.cuny.struct.SortedTreeList<Shout> in, edu.cuny.struct.SortedTreeList<Shout> out)
protected void distributeShoutsFromHead(int quantity, edu.cuny.struct.SortedTreeList<Shout> list, edu.cuny.struct.SortedTreeList<Shout> in, edu.cuny.struct.SortedTreeList<Shout> out)
protected void distributeShouts(int quantity, edu.cuny.struct.SortedTreeList<Shout> list, edu.cuny.struct.SortedTreeList<Shout> in, edu.cuny.struct.SortedTreeList<Shout> out, boolean fromTail)
public int calculateMatchingQuantity()
public java.util.List<Shout> matchShouts()
Return a list of matched bids and asks. The list is of the form
where bi is the ith bid and a0 is the ith ask. A typical auctioneer would clear by matching bi with ai for all i at some price.
matchShouts
in class ShoutEngine
protected void randomizeMatches(java.util.List<Shout> result)
result
- public java.util.Iterator<Shout> askIterator()
askIterator
in class ShoutEngine
public java.util.Iterator<Shout> ascendingAskIterator()
ascendingAskIterator
in class ShoutEngine
public java.util.Iterator<Shout> bidIterator()
bidIterator
in class ShoutEngine
public java.util.Iterator<Shout> descendingBidIterator()
descendingBidIterator
in class ShoutEngine
public java.util.Iterator<Shout> matchedAskIterator()
matchedAskIterator
in class ShoutEngine
public java.util.Iterator<Shout> matchedBidIterator()
matchedBidIterator
in class ShoutEngine
public Shout getLowestUnmatchedAsk()
ShoutEngine
getLowestUnmatchedAsk
in class ShoutEngine
public Shout getHighestMatchedAsk()
ShoutEngine
getHighestMatchedAsk
in class ShoutEngine
public Shout getHighestUnmatchedBid()
ShoutEngine
getHighestUnmatchedBid
in class ShoutEngine
public Shout getLowestMatchedBid()
ShoutEngine
getLowestMatchedBid
in class ShoutEngine
public int getMatchedVolume()
getMatchedVolume
in class ShoutEngine
matchingVolume
.public int getUnmatchedSupply()
getUnmatchedSupply
in class ShoutEngine
public int getUnmatchedDemand()
getUnmatchedDemand
in class ShoutEngine
public int getNumOfUnmatchedBids()
getNumOfUnmatchedBids
in class ShoutEngine
public int getNumOfMatchedBids()
getNumOfMatchedBids
in class ShoutEngine
public int getNumOfUnmatchedAsks()
getNumOfUnmatchedAsks
in class ShoutEngine
public int getNumOfMatchedAsks()
getNumOfMatchedAsks
in class ShoutEngine
public org.apache.commons.collections15.buffer.PriorityBuffer<Shout> getMatchedBids()
getMatchedBids
in class ShoutEngine
public org.apache.commons.collections15.buffer.PriorityBuffer<Shout> getUnmatchedBids()
getUnmatchedBids
in class ShoutEngine
public org.apache.commons.collections15.buffer.PriorityBuffer<Shout> getMatchedAsks()
getMatchedAsks
in class ShoutEngine
public org.apache.commons.collections15.buffer.PriorityBuffer<Shout> getUnmatchedAsks()
getUnmatchedAsks
in class ShoutEngine
public void printState()
printState
in class ShoutEngine
public void prettyPrint(java.lang.String title, java.util.List<Shout> shouts)
public java.lang.String toString()
toString
in class AuctioneerPolicy
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |