EMBS 2024 Assessment Information
Packet Formats
Your solution will communicate with the server to request scenarios to solve. This is the format of the messages that you should send.
The server is at IP 192.168.10.1
on port 51100
. Remember to use your IP address.
Request
Send this to the server to request a scenario.
Field Name | Width in bytes | Details |
Message ID | 1 |
|
Number of cities | 1 | Between 4 and 20 inclusive |
Scenario ID | 4 | A big-endian 4 byte integer (see below) used to identify the scenario. |
Request Response
The server will respond as follows:
Message ID | 1 |
|
Number of cities | 1 | Set to whatever you requested. |
Scenario ID | 4 | Set to whatever you requested. |
Adjacency matrix |
| See below. |
The adjacency matrix is encoded as a list of unsigned bytes, encoding the distance between cities. A city is always 0 from itself and all distances are symmetric (distance(X,Y) == distance(Y,X)
). If n
is the number of cities, cities are numbered from 0
to n-1
, and d(x,y)
is the distance from city x
to city y
the list is:
|
|
|
|
|
|
|
|
|
|
|
Solve
After solving the scenario, send this to the server to check your answer.
Message ID | 1 |
|
Number of cities | 1 | Between 4 and 20 inclusive |
Scenario ID | 4 | A big-endian 4 byte integer used to identify the scenario. |
Shortest path | 4 | A big-endian 4 byte integer that is the length of the shortest path. |
Solve Reply
Sent in response to Solve
messages.
Message ID | 1 |
|
Number of cities | 1 | Between 4 and 20 inclusive |
ID | 4 | A big-endian 4 byte integer used to identify the scenario. |
Answer | 1 |
|
The server has only pre-calculated the answer for the first few scenarios, but it can generate any random set of cites from the four byte ID. If you try to check the answer of one of these other scenarios then Solve Reply
will reply with value 3 - Unknown
.
Example
An example scenario from the server is:
Size 4, ID 3:
[0 177 252 18]
[177 0 73 250]
[252 73 0 189]
[ 18 250 189 0]
Answer: 457
Endianness
If you can't remember endianness from first year, these diagrams show how big and little endian numbers are stored.