CS404 Agent-based Systems Coursework

Auction Games
CS404 Agent-based Systems Coursework
1 Introduction
Imagine an auction of paintings by famous artists. There is an auction room, with an auctioneer that presents
each piece to be sold, and all bidders then write their bids for the item onto a secret sealed note that is handed
to the auctioneer. The auctioneer then declares the highest bidder the winner, takes their payment, and starts
the next round with a new item. There might be a target number of paintings by the same artist to get, in
which case the first bidder to get this wins; otherwise, the auction continues until everyone runs out of money
or there are no more items to sell, and the bidder with the highest total value of paintings is the winner.
Your objective is to implement strategies for a Python 3 bidding bot that will participate in such an auction.
2 The Auction
The auction runs in the following way. A number of bidders connects to the AuctionServer, which then announces
the winning condition, the item types (i.e, the artists) and the number of each being sold and value of each of
these types, how much each money each bidder starts with, which bid the highest bidder will pay and optionally
the sequence of the auction.
The AuctionServer will then announce an item type to be bid upon. Your AuctionClient will use the above
information to determine an amount to bid and submit it to the AuctionServer. Once done, the AuctionServer
will declare the highest bidder the winner, who will then be charged (but not necessarily the amount they bid,
see below) and receives the item. If there are drawn positive bids, then the winner is chosen at random from
the drawn bidders; if however the drawn bids are all at 0 (no-one bid), no-one wins, and the item is discarded.
The auction will continue until either there are no more items to sell, all bidders have run out of money, or if
there is a set winning condition, e.g., a bidder managed to acquire N items of the same type, in which case they
are declared the grand winner. If there is no set winning condition, the game will only end once one of the first
two conditions is met, and then the bidder who ends with the highest total value in items is the grand winner.
Note that however whilst the highest bidder will always win, the auction may be set up so the highest bidder
does not pay their own bid. It can be set up so that the highest bidder is only charged the second highest bid
(see winner pays).
You will write your strategies in AuctionClient, and then everyone’s AuctionClients will all be logged into one
AuctionServer, where a tournament will be played across four games:
Game 1: First to buy 5 of any artist wins, the highest bidder pays own bid, and the auction order known.
Game 2: First to buy 5 of any artist wins, the highest bidder pays own bid, but the auction order is not
known.
Game 3: Highest total value at the end wins, the highest bidder pays own bid, and the auction order
known.
Game 4: Highest total value at the end wins, the highest bidder pays the second highest bid, and the
auction order known.
Note that for all games in this tournament, there will be four types, (Picasso, Van Gogh, Rembrandt and
Da Vinci), the auction size will be 200, the starting budget 1000, and where the win condition is based on final
value, each Picasso is worth 4, Van Gogh worth 6, Rembrandt worth 8 and Da Vinci worth 12.
CS404 Agent Based Systems Coursework
3 Implementation
Provided to you are four Python 3 files: AuctionServer, AuctionClient, run auction and run client.
AuctionServer contains the definition for the AuctionServer class, which sets up and runs the auction. It has
the following arguments:
host: Where the server will be hosted, keep this at ”localhost” for your own testing.
ports: Either a list of port sockets that the clients will connect through, or if a single number, P, is given,
it will use all ports from P to P + numbidders. If you get any error that a port is already in use or locked
or something, just change this number to any other number above 1000 and try again.
numbidders: The number of clients i.e., bidders, that will be playing.
neededtowin: The number of the same type of painting a player needs to get to be the grand winner. If
0, then the total value once the auction has ended will be used to declare the grand winner instead.
itemtypes: List of the different types of paintings, i.e, the different artists.
numitems: A dict that can either be used to manually set how many items of each type there should be
in the auction, or if unset i.e., ”numitems={}”, this is generated randomly according to auction size.
auction size: If numitems is set, this should be 0. Otherwise, this is how many items are in the auction;
items will be randomly generated until there are this many to sell.
budget: The starting budget of all the players.
values: A dict of the value for each type. This will be used to determine the total value for each player
if neededtowin == 0
announce order: If True, the bidders are told the sequence of the items to be sold before auction begins.
If False, they are not, and will have to use numitems and the past bidding record to guess which item will
be sold next.
winner pays: An index of which bid the highest bidder pays. If 0, they pay their own bid, if 1 they pay
the second highest, if 2 the third etc... Note however that the winner always pays at least 1, even if the
second highest is 0.
The function announce auction sets up and announces the auction details to all clients, whilst run auction
can then run the auction until it is completed.
AuctionClient is the code for a bidding client, and this is where you will implement your strategies. Note that
an AuctionServer must be initialised first so it is listening on the given ports before an AuctionClient can be
initialised and connect to the server. It has the following arguments:
host: Where the AuctionServer to connect to is hosted, keep this at ”localhost” for your own testing.
? port: The port to connect to the AuctionServer to. This must be unique to this AuctionClient (no other
AuctionClient can use this port), and an initialised AuctionServer must be ready and listening to this
port.
mybidderid: The name for your bidder. If not given with initialisation, you will be asked to input this
on the command line. Note that it must be unique to your bidder, and can contain alphanumeric or
underscore characters.
verbose: If set to True, then your client will print out statements detailing its input and progress.
The function play auction runs the loop for receiving data from the AuctionServer and passing the bids back
until the auction is done.
You will also see provisionally defined functions of determinebid and four bidding strategy functions for
each of the four games, and it is in these functions you should implement the algorithm for your strategies.
2
CS404 Agent Based Systems Coursework
Currently, they just run the function random bid, which returns a random number between 1 and amount of
budget the bidder has left. You can use this random strategy to test your strategy against.
determinebid receives all the relevant data as input and has a comment block that explains what each argument
is. If you wish, you are also free to access and create self defined variables, which may be useful if you want to
store state between calls of determinebid. You may also add code to the init or play auction functions to
help achieve this, but be very careful not to change either the networking code or the auction parameters or you
might either crash or confuse your bot! Also note that if your bidder tries to bid more than it has budget left
(accessible by standings[mybidderid][’money’]), the AuctionServer will cap the bid to its current budget.
run auction is a script to initialise an AuctionServer with the given parameters and start it running and waiting
for AuctionClients to connect. Once it is set up, you can manually run AuctionClients by initialising them with
a port the AuctionServer is listening on, and once numbidders AuctionClients have connected to the server on
their different ports, it will run the auction.
run clients is a script that automatically initialises and runs not only an AuctionServer, but also numbidders
number of AuctionClients, and is provided for convenient testing.
4 Submission
Your coursework submission will consist of a single compressed file (either .zip or .tgz) containing:
An AuctionClient.py file, encoding the strategies for each game.
A four pages Analysis.pdf file, with the analysis of each of the four corresponding strategies and the
reasons of your design choices. The pdf should be written in IEEE two-column conference format.
The coursework file should be submitted through Tabula.
Each submission will be run as follows. We first set up the auction with the desired parameters for each
tournament in the run auction.py script, then run it. This will create an auction room with those parameters.
Then we will run each student’s client with the following three lines in a Python script:
import AuctionClient from [submission filename]
bidbot = AuctionClient(port=[Unique port], mybidderid=[student ID])
bidbot.play auction()
Where [submission filename] is the filename of the student’s submission, [Unique port] is one of the ports the
AuctionSever is configured to listen on and [student ID] is the student’s unique ID. Your submission file name
should be named with your student ID, followed by the suitable extension.
Please make sure that your submission is suitable for this operation.
5 Evaluation
The coursework is worth 50% of the module credit. Its marking scheme is structured as follows:
30% strategy implementation (how you design and structure your strategies)
30% strategy performance (how each strategy performs in the games)
40% quality of the analysis (how you describe and analyse your strategies)
Each of the four strategies will be evaluated independently and the result averaged across them.
3
CS404 Agent Based Systems Coursework
6 Cheating/Plagiarism
This coursework is an individual piece of work. All submissions will be put through plagiarism detection
software which compares against a number of sources, including other submissions for CS404, submissions at
other universities, web sources, conference papers, journals and books. Please see the student handbook for
more information, or ask if you need guidance.
Acknowledgements
The code has been developed by Alexander Carver, Department of Computing, Imperial College London
(alexander.carver15@imperial.ac.uk).
4

代写CS404留学生作业、代做Systems Coursework作业、代做Python语言作业、Python编程作业调试
Auction Games
CS404 Agent-based Systems Coursework
1 Introduction
Imagine an auction of paintings by famous artists. There is an auction room, with an auctioneer that presents
each piece to be sold, and all bidders then write their bids for the item onto a secret sealed note that is handed
to the auctioneer. The auctioneer then declares the highest bidder the winner, takes their payment, and starts
the next round with a new item. There might be a target number of paintings by the same artist to get, in
which case the first bidder to get this wins; otherwise, the auction continues until everyone runs out of money
or there are no more items to sell, and the bidder with the highest total value of paintings is the winner.
Your objective is to implement strategies for a Python 3 bidding bot that will participate in such an auction.
2 The Auction
The auction runs in the following way. A number of bidders connects to the AuctionServer, which then announces
the winning condition, the item types (i.e, the artists) and the number of each being sold and value of each of
these types, how much each money each bidder starts with, which bid the highest bidder will pay and optionally
the sequence of the auction.
The AuctionServer will then announce an item type to be bid upon. Your AuctionClient will use the above
information to determine an amount to bid and submit it to the AuctionServer. Once done, the AuctionServer
will declare the highest bidder the winner, who will then be charged (but not necessarily the amount they bid,
see below) and receives the item. If there are drawn positive bids, then the winner is chosen at random from
the drawn bidders; if however the drawn bids are all at 0 (no-one bid), no-one wins, and the item is discarded.
The auction will continue until either there are no more items to sell, all bidders have run out of money, or if
there is a set winning condition, e.g., a bidder managed to acquire N items of the same type, in which case they
are declared the grand winner. If there is no set winning condition, the game will only end once one of the first
two conditions is met, and then the bidder who ends with the highest total value in items is the grand winner.
Note that however whilst the highest bidder will always win, the auction may be set up so the highest bidder
does not pay their own bid. It can be set up so that the highest bidder is only charged the second highest bid
(see winner pays).
You will write your strategies in AuctionClient, and then everyone’s AuctionClients will all be logged into one
AuctionServer, where a tournament will be played across four games:
Game 1: First to buy 5 of any artist wins, the highest bidder pays own bid, and the auction order known.
Game 2: First to buy 5 of any artist wins, the highest bidder pays own bid, but the auction order is not
known.
Game 3: Highest total value at the end wins, the highest bidder pays own bid, and the auction order
known.
Game 4: Highest total value at the end wins, the highest bidder pays the second highest bid, and the
auction order known.
Note that for all games in this tournament, there will be four types, (Picasso, Van Gogh, Rembrandt and
Da Vinci), the auction size will be 200, the starting budget 1000, and where the win condition is based on final
value, each Picasso is worth 4, Van Gogh worth 6, Rembrandt worth 8 and Da Vinci worth 12.
CS404 Agent Based Systems Coursework
3 Implementation
Provided to you are four Python 3 files: AuctionServer, AuctionClient, run auction and run client.
AuctionServer contains the definition for the AuctionServer class, which sets up and runs the auction. It has
the following arguments:
host: Where the server will be hosted, keep this at ”localhost” for your own testing.
ports: Either a list of port sockets that the clients will connect through, or if a single number, P, is given,
it will use all ports from P to P + numbidders. If you get any error that a port is already in use or locked
or something, just change this number to any other number above 1000 and try again.
numbidders: The number of clients i.e., bidders, that will be playing.
neededtowin: The number of the same type of painting a player needs to get to be the grand winner. If
0, then the total value once the auction has ended will be used to declare the grand winner instead.
itemtypes: List of the different types of paintings, i.e, the different artists.
numitems: A dict that can either be used to manually set how many items of each type there should be
in the auction, or if unset i.e., ”numitems={}”, this is generated randomly according to auction size.
auction size: If numitems is set, this should be 0. Otherwise, this is how many items are in the auction;
items will be randomly generated until there are this many to sell.
budget: The starting budget of all the players.
values: A dict of the value for each type. This will be used to determine the total value for each player
if neededtowin == 0
announce order: If True, the bidders are told the sequence of the items to be sold before auction begins.
If False, they are not, and will have to use numitems and the past bidding record to guess which item will
be sold next.
winner pays: An index of which bid the highest bidder pays. If 0, they pay their own bid, if 1 they pay
the second highest, if 2 the third etc... Note however that the winner always pays at least 1, even if the
second highest is 0.
The function announce auction sets up and announces the auction details to all clients, whilst run auction
can then run the auction until it is completed.
AuctionClient is the code for a bidding client, and this is where you will implement your strategies. Note that
an AuctionServer must be initialised first so it is listening on the given ports before an AuctionClient can be
initialised and connect to the server. It has the following arguments:
host: Where the AuctionServer to connect to is hosted, keep this at ”localhost” for your own testing.
? port: The port to connect to the AuctionServer to. This must be unique to this AuctionClient (no other
AuctionClient can use this port), and an initialised AuctionServer must be ready and listening to this
port.
mybidderid: The name for your bidder. If not given with initialisation, you will be asked to input this
on the command line. Note that it must be unique to your bidder, and can contain alphanumeric or
underscore characters.
verbose: If set to True, then your client will print out statements detailing its input and progress.
The function play auction runs the loop for receiving data from the AuctionServer and passing the bids back
until the auction is done.
You will also see provisionally defined functions of determinebid and four bidding strategy functions for
each of the four games, and it is in these functions you should implement the algorithm for your strategies.
2
CS404 Agent Based Systems Coursework
Currently, they just run the function random bid, which returns a random number between 1 and amount of
budget the bidder has left. You can use this random strategy to test your strategy against.
determinebid receives all the relevant data as input and has a comment block that explains what each argument
is. If you wish, you are also free to access and create self defined variables, which may be useful if you want to
store state between calls of determinebid. You may also add code to the init or play auction functions to
help achieve this, but be very careful not to change either the networking code or the auction parameters or you
might either crash or confuse your bot! Also note that if your bidder tries to bid more than it has budget left
(accessible by standings[mybidderid][’money’]), the AuctionServer will cap the bid to its current budget.
run auction is a script to initialise an AuctionServer with the given parameters and start it running and waiting
for AuctionClients to connect. Once it is set up, you can manually run AuctionClients by initialising them with
a port the AuctionServer is listening on, and once numbidders AuctionClients have connected to the server on
their different ports, it will run the auction.
run clients is a script that automatically initialises and runs not only an AuctionServer, but also numbidders
number of AuctionClients, and is provided for convenient testing.
4 Submission
Your coursework submission will consist of a single compressed file (either .zip or .tgz) containing:
An AuctionClient.py file, encoding the strategies for each game.
A four pages Analysis.pdf file, with the analysis of each of the four corresponding strategies and the
reasons of your design choices. The pdf should be written in IEEE two-column conference format.
The coursework file should be submitted through Tabula.
Each submission will be run as follows. We first set up the auction with the desired parameters for each
tournament in the run auction.py script, then run it. This will create an auction room with those parameters.
Then we will run each student’s client with the following three lines in a Python script:
import AuctionClient from [submission filename]
bidbot = AuctionClient(port=[Unique port], mybidderid=[student ID])
bidbot.play auction()
Where [submission filename] is the filename of the student’s submission, [Unique port] is one of the ports the
AuctionSever is configured to listen on and [student ID] is the student’s unique ID. Your submission file name
should be named with your student ID, followed by the suitable extension.
Please make sure that your submission is suitable for this operation.
5 Evaluation
The coursework is worth 50% of the module credit. Its marking scheme is structured as follows:
30% strategy implementation (how you design and structure your strategies)
30% strategy performance (how each strategy performs in the games)
40% quality of the analysis (how you describe and analyse your strategies)
Each of the four strategies will be evaluated independently and the result averaged across them.
3
CS404 Agent Based Systems Coursework
6 Cheating/Plagiarism
This coursework is an individual piece of work. All submissions will be put through plagiarism detection
software which compares against a number of sources, including other submissions for CS404, submissions at
other universities, web sources, conference papers, journals and books. Please see the student handbook for
more information, or ask if you need guidance.
Acknowledgements
The code has been developed by Alexander Carver, Department of Computing, Imperial College London
(alexander.carver15@imperial.ac.uk).
4

http://www.6daixie.com/contents/3/2826.html

原文地址:https://www.cnblogs.com/pythonhelpyou/p/10623133.html

时间: 2024-11-09 00:06:16

CS404 Agent-based Systems Coursework的相关文章

PatentTips - Systems, methods, and devices for dynamic resource monitoring and allocation in a cluster system

BACKGROUND? 1. Field? The embodiments of the disclosure generally relate to computer clusters, and more particularly to systems, methods, and devices for the efficient management of resources of computer clusters.? 2. Description of the Related Art?

Uniform synchronization between multiple kernels running on single computer systems

The present invention allocates resources in a multi-operating system computing system, thereby avoiding bottlenecks and other degradations that result from competition for limited resources. In one embodiment, a computer system includes resources an

Position Based Dynamics【译】

绝大部分机翻,少部分手动矫正,仅供参考.本人水平有限,如有误翻,概不负责... Position Based Dynamics Abstract The most popular approaches for the simulation of dynamic systems in computer graphics are force based. Internal and external forces are accumulated from which accelerations are

Interrupt distribution scheme for a computer bus

A method of handling processor to processor interrupt requests in a multiprocessing computer bus environment is described. This method allows a multiple-tiered, increasing priority, interrupt request scheme. This method also allows processor to proce

计算机会议排名等级

http://blog.sina.com.cn/s/blog_9c411c310102vs2g.html 附件是计算机领域的学术会议等级排名情况,分为A+, A, B, C, L 共5个档次.其中A+属于顶级会议,基本是这个领域全世界大牛们参与和关注最多的会议.国内的研究者能在其中发表论文的话,是很值得骄傲的成就.A类也是非常好的会议了,尤其是一些热门的研究方向,A类的会议投稿多录用率低,部分A类会议影响力逐步逼近A+类会议.B类的会议分两种,一种称为盛会级,参与的人多,发表的论文也多,论文录用

教你如何阅读Oracle数据库官方文档

< Ask Oracle官方原创 > Oracle 官方文档 数量庞大,而且往往没有侧重点,让oracle新手看起来很费力.但是,仍有很多Oracle使用者认为任何oracle学习资料都比不上Oracle官方文档的权威和扼要,且兼具基础与全面.这种差异可能与个人的阅读方法有很大关系, <Ask Oracle官方原创> Oracle官方文档数量庞大,而且往往没有侧重点,让oracle新手看起来很费力.但是,仍有很多Oracle使用者认为任何oracle学习资料都比不上Oracle官方

SCI&amp;EI 英文PAPER投稿经验【转】

英文投稿的一点经验[转载] From: http://chl033.woku.com/article/2893317.html 1. 首先一定要注意杂志的发表范围, 超出范围的千万别投,要不就是浪费时间;另外,每个杂志都有他们的具体格式要求,一定要按照他们的要求把论文写好,免得浪费时间,前些时候,我的一个同事向一个著名的英文杂志投稿,由于格式问题,人家过两个星期就退回来了,而且说了很多难听的话,说投稿前首先就应该看清楚他们的格式要求:2. 论文写作一定要言简意赅,特别是摘要,引言和结论部分,特别

Globalization Guide for Oracle Applications Release 12

Section 1: Overview Section 2: Installing Section 3: Configuring Section 4: Maintaining Section 5: Using Section 6: Customizing Section 7: Translating Section 8: Troubleshooting Appendix A: Migrating to Unicode Appendix B: Locale Data Section 1. Over

【外文】XSSer automatic tool for pentesting XSS attacks against different applications

原文 http://xsser.sourceforge.net/ Introduction Cross Site "Scripter" (aka XSSer) is an automatic -framework- to detect, exploit and report XSS vulnerabilities in web-based applications. It contains several options to try to bypass certain filters