-
Notifications
You must be signed in to change notification settings - Fork 0
/
Drone.h
52 lines (37 loc) · 1.27 KB
/
Drone.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#pragma once
//#include <size_t>
#include <vector>
#include <map>
#include "Point.h"
#include "Product.h"
enum DroneState { FREE, BUSY, ACCEPTED };
class Warehouse;
class Order;
typedef std::vector<std::pair<Warehouse*,std::vector<Product>>> OrderPlan;
class Drone {
public:
Drone(int id, Point starting_location, int capacity);
int getId() const;
Point getLocation() const;
int getCapacity() const;
// Simulation
void tick();
// Order Processing
void announce(std::vector<Order> &orders);
void reannounce();
void makeReservations();
void accept(Order * order);
void cancel();
static bool hasUnaccepted(std::vector<Drone> &drones);
static bool hasFree(std::vector<Drone> &drones);
private:
std::pair<int,OrderPlan> determineCost(Order * order);
int m_id;
Point m_location;
int m_capacity;
// State
DroneState m_state;
Order * m_accepted_order;
OrderPlan m_order_plan;
std::map<Order*,int> m_costs;
};