In order to make deliveries you will operate a delivery car, which can take positions and make moves as specified below.
Car position: A car can generally take two types of position:
Car move: At each step 0 \le t < T_{\text{max}} you have to choose one of the following actions in order to control your delivery car.
stay
: stay at the current position.move w
: Take one step towards vertex w \in V.In case of choosing move w
, w must obey the following constraints. A failure to obey these constraints results in a wrong answer WA
.
\text{Score} = \sum_{i \in D} {(T_{\text{max}})}^{2} - {(\mathrm{waitingTime}_i)}^{2},
Here we use the following definitions:WA
will receive 0 points.In problem A we pass all orders which appear at time 0 \le t < 0.95 \times T_{\text{max}} as an input to the contestant code. The task is to provide an algorithm which optimizes the moves of the car such that the above score becomes maximal.
Input is provided in the following form:
|V| |E| u_{1} v_{1} d_{u_{1}, v_{1}} u_{2} v_{2} d_{u_{2}, v_{2}} : u_{|E|} v_{|E|} d_{u_{|E|}, v_{|E|}} T_{\text{max}} \mathrm{info}_{0} \mathrm{info}_{1} : \mathrm{info}_{T_{\text{max}}-1}
In the following line, \mathrm{info}_t is information about the order from the customer that occurs at time t. \mathrm{info}_t is given in the form:
N_{\text{new}} \mathrm{new\_id}_1 \mathrm{dst}_1 \mathrm{new\_id}_2 \mathrm{dst}_2 \vdots \mathrm{new\_id}_{N_{\text{new}}} \mathrm{dst}_{N_{\text{new}}}
The Output expects T_{\text{max}} integers in the format specified below.
\mathrm{command}_{0} \mathrm{command}_{1} : \mathrm{command}_{T_{\text{max}}-1}
In particular, \mathrm{command}_{i} shall specify the movement of the delivery car by using one of the following two options:
1) stay
, if the car shall not move:
-1
2) move w
, if the car shall be moved one step towards the neighboring vertex w
w
Note that in case of 2) w has to satisfy the following conditions:
5 7 1 2 5 5 3 4 2 4 8 1 5 1 2 3 3 4 5 3 4 3 9 4 1 1 2 1 2 5 1 3 4 0
Note that this input is an example of small size and does not meet the constraints of the contest.
2 -1 1 5
The example operates on a graph with |V| = 5 vertices, |E| = 7 edges, and T_{\text{max}} = 4 time steps. We now describe the orders which have occured and the movement of the car.
At time t=0 an order is placed at the shop. This order has ID= 1 and should be delivered to vertex 2. Because your car is currently at vertex one, the order will be automatically transfered into your car. In this way, when your car is at the shop, all orders which have been made at present and before, will automatically be loaded into your car.
You choose to move towards vertex move 2
. You will now move one step towards vertex 2.
A new order has appeared. It has ID =2 and shall be delivered at vertex 5.
You decided to stay
. You can now stay on the edge where you are.
A new order has appeared. It has ID =3 and shall be delivered at vertex 4.
You decided to move move 1
back to vertex 1.
You are approaching one step towards vertex 1.
Doing a U-turn in this way is explicitly allowed.
New orders have not occurred. Now that you are at the vertex 1 (store), the orders with order ID 2, 3 are loaded into your car. In a similar way, whenever you return to the store, all the orders that have already been placed are loaded into your car automatically.
Being at vertex 1 you choose move 5
. You are moving your car one step towards vertex 5. You arrive at vertex 5.
Since you arrived at vertex 5, the order with order ID 2 can be delivered.
A software toolkit for generation of input samples, scoring and testing on a local contestant environment, and sample codes for beginners is provided through the following link. In addition we provide software for visualizing the contestants results.