Presentation is loading. Please wait.

Presentation is loading. Please wait.

Peer-to-peer and agent- based computing “Implementation” of Auctions.

Similar presentations


Presentation on theme: "Peer-to-peer and agent- based computing “Implementation” of Auctions."— Presentation transcript:

1 peer-to-peer and agent- based computing “Implementation” of Auctions

2 peer-to-peer and agent-based computing – wamberto vasconcelos 2 A word on “implementation”... It’s not really Java It’s pseudo-code –Algorithms –Some elements of “realism” Purpose: –Flesh out details of what happens before/after messages are sent/received –Detail the information of each message –NOT to define “business logic” to use programs in eBay (thus maximising profit...)

3 peer-to-peer and agent-based computing – wamberto vasconcelos 3 English Auction “Official” standard from FIPA (www.fipa.org)

4 peer-to-peer and agent-based computing – wamberto vasconcelos 4 Auctioneer pseudocode (1) input: Agent id, good to sell g and its reserve price p, bidders B = {b 0,…,b n } output: winner  B and price fp  p or false (if no winner) auctioneer(id, B, p) 1. ac ← fresh auction id // e.g., time or a random number 2. winner ← nil; fp ← p // initialise winner and fp 3. for all b  B do send(id, b, inform-start-of-auction,  g, ac  ) 4. for all b  B do send(id, b, cfp,  g, fp, ac  ) 5. Msgs ← receiveMsgs (ac) // receive msgs 6.  Losers, hb, hp  ← processMsgs (fp, ac, Msgs) // get highest bid & losers 7. if hb = nil then // no “good” bids now 8. if winner = nil then return false // no previous winner 9. else // we had a previous winner 10. send(id, winner, request,  g, fp, ac  ) // request payment 11. B ’ ← B \ {winner } // get “other” bidders’ ids 12. for all b  B do send(id, b, inform,  g, fp, winner, ac  ) // inform who won 13. return  fp, winner, ac  // return winner 14. else 15. winner ← hb ; fp ← hp // update winner and current price 16. send(id, winner, accept-proposal,  g, fp, ac  ) // accept highest bid 17. for all  b, p   Losers do send(id, b, reject-proposal,  g, p, ac  ) 18. go to 4

5 peer-to-peer and agent-based computing – wamberto vasconcelos 5 Auctioneer pseudocode (2) input: Auction id ac output: set of received messages Msgs receiveMsgs(ac) 1. Msgs ←  2. patienceLimit ← while patienceLimit > 0 do 4. receive(m) // non-blocking receive; m = nil, if no msg 5. if m = nil then 6. patienceLimit ← patienceLimit  1 7. sleep 5ms 8. else 9. Msgs ←  Msgs  {m } 10. remove from Msgs messages with different ac 11. return Msgs

6 peer-to-peer and agent-based computing – wamberto vasconcelos 6 Auctioneer pseudocode (3) input: Current higher price fp, auction id ac, messages Msgs = {m 0,…,m n } output:  Losers,hb,hp  (Losers failed bids, hb/hp successful bidder/price) processMsgs(fp, ac, Msgs) 1. Losers ←  2. for all m  Msgs do 3. if m =  b, a, not-understood, ac  then Msgs ← Msgs – {m } // filter 4. if Msgs =  then return ,nil,nil  5. for all m  Msgs do 6. if m =  b, a, propose,  g, p, ac  then 7. if p < fp then // less than current highest offer? 8. Losers ← Losers  {  b, p  } // add to set of losers 9. Msgs ← Msgs – {m } // remove from msgs 10. pick m  Msgs such that m =  b, a, propose,  g, p, ac  11. hb ← b ; hp ← p 12. for all m  Msgs do 13. if m =  b, a, propose,  g, p, ac  then 14. if p > hp then // higher bid? 15. Losers ← Losers  {  hb, hp  } // previous highest is loser 16. hb ← b; hp ← p // update highest bidder and bid 17. else // equal bid? 18. Losers ← Losers  {  b, p  } // add to losers 17. return  Losers,hb,hp 

7 input: Ag. id, good g, highest price hp, increase % in bid inc output: price paid pp  hp or nil (if unsuccessful in auction) bidder(id, g, hp, inc) 1.Bid ← nil; pp ← nil 2.Msgs ← receiveMsgs // receive msgs 3.As ← {m  Msgs | m =  a, id, inform-start-of-auction,  g, ac  } // auctions of g 4.choose auction m  As, m =  a, id, inform-start-of-auction,  g, ac  5.Msgs ← receiveMsgs // receive msgs 6.CFPs ← {m  Msgs | m =  a, id, cfp,  g, p, ac  and p  hp } // get cfps 7.if CFPs =  then go to 1 // nothing of interest so far… peer-to-peer and agent-based computing – wamberto vasconcelos 7 Bidder pseudocode (1)

8 input: Agent id, good to buy g, highest price hp, increase % in bid inc output: price paid pp  hp or nil (if unsuccessful in auction) bidder(id, g, hp, inc) … 8.get from CFPs the lowest offer, m =  a, id, cfp,  g, p, ac  9.offer ← (p + (p  inc /100)) 10.if Bid = nil and offer  hp then // no pending bids & offer OK 11. send(id, a, propose,  g, offer, ac  ) 12. go to 5 13.if  a, id, accept-proposal,  g, p, ac   Msgs then // offer accepted 14. Bid ←  a, p, ac  15. go to 5 16.if  a, id, reject-proposal,  g, offer, ac   Msgs then // offer rejected 17. go to 1 18.if  a, id, inform,  g, p, winner, ac   Msgs then // someone won if id = winner then // it was me! 20. pp ← offer 21. //... wait for payment request; perform payment; etc return pp 23. else // someone else won return nil peer-to-peer and agent-based computing – wamberto vasconcelos 8 Bidder pseudocode (2)

9 input: Agent id, good to buy g, highest price hp, increase % in bid inc output: price paid pp  hp or nil (if unsuccessful in auction) bidder(id, g, hp, inc) 1.Bid ← nil; pp ← nil 2.Msgs ← receiveMsgs // receive msgs 3.As ← { m  Msgs | m =  a, id, inform-start-of-auction,  g, ac  } // get all auctions of good g 4.choose one of the auctions m  As, m =  a, id, inform-start-of-auction,  g, ac  5.Msgs ← receiveMsgs // receive msgs 6.CFPs ← { m  Msgs | m =  a, id, cfp,  g, p, ac  and p  hp } // get “affordable” cfps 7.if CFPs =  then go to 1 // nothing of interest so far… 8.get from CFPs the lowest offer, m =  a, id, cfp,  g, p, ac  9.offer ← (p + (p  inc /100)) 10.if Bid = nil and offer  hp then // no pending bids & offer OK 11. send(id, a, propose,  g, offer, ac  ) 12. go to 5 13.if  a, id, accept-proposal,  g, p, ac   Msgs then // offer accepted 14. Bid ←  a, p, ac  15. go to 5 16.if  a, id, reject-proposal,  g, offer, ac   Msgs then // offer rejected 17. go to 1 18.if  a, id, inform,  g, p, winner, ac   Msgs then // someone won if id = winner then // it was me! 20. pp ← offer 21. //... wait for payment request; perform payment; etc return pp 23. else // someone else won return nil peer-to-peer and agent-based computing – wamberto vasconcelos 9 Bidder pseudocode (3)

10 peer-to-peer and agent-based computing – wamberto vasconcelos 10 Issues The auction id is essential as there might be many auctions going on at the same time Cases: –No bidders –“normal” bidders –Bidders with the wrong auction/good id No need to record “round” of algorithm – why? –Algorithm deals with messages “out of order” –E.g.: the current highest bid is N and a “late” bidder has just sent a bid for the previous offer of N – 10

11 peer-to-peer and agent-based computing – wamberto vasconcelos 11 Issues (2) Could you extend auctioneer to cope with many goods with simultaneous auctions? –Each good would be associated with a different auction –Bids would not be confused as they are associated with an auction id Could you extend bidder to cope with many goods and a budget to buy them all? –Each item the bidder buys should reflect on the budget for the remaining items –Bidder should “leave” the auction (i.e., stop running) when budget is spent

12 peer-to-peer and agent-based computing – wamberto vasconcelos 12 Issues (3) Can you adapt the auctioneer and bidders so that they enact the Dutch auction?

13 peer-to-peer and agent-based computing – wamberto vasconcelos 13 Issues (4) Bidders may be outpriced They could join efforts: –Buying in bulk and splitting costs/goods How would bidders change to allow the formation of “co-operatives” –Overall purchase power is the sum of individual highest price –Bidders could use up part of their budget –One of the bidders would be the organiser In the English auction, the cooperative could be disbanded and reformed –When the price exceeds the limit of the cooperative then the cooperative is dissolved and another one re- formed


Download ppt "Peer-to-peer and agent- based computing “Implementation” of Auctions."

Similar presentations


Ads by Google