PGROUTING  3.2
fleet.h
Go to the documentation of this file.
1 /*PGR-GNU*****************************************************************
2 
3 FILE: fleet.h
4 
5 Copyright (c) 2017 pgRouting developers
7 
8 ------
9 
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
14 
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
19 
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 
24  ********************************************************************PGR-GNU*/
25 
28 #ifndef INCLUDE_VRP_FLEET_H_
29 #define INCLUDE_VRP_FLEET_H_
30 #pragma once
31 
32 #include <iosfwd>
33 #include <vector>
34 #include <memory>
35 #include <utility>
36 
38 #include "vrp/pd_problem.h"
40 
41 namespace pgrouting {
42 namespace vrp {
43 
44 class Pgr_pickDeliver;
45 class PD_Orders;
46 
47 class Fleet {
48  friend class PD_problem;
49 
50  public:
51  typedef std::vector<Vehicle_pickDeliver>::iterator iterator;
52 
53 
54  public:
58  Fleet() = default;
59 
60  Fleet(const std::vector<Vehicle_t> &vehicles, double factor);
61 
62  Fleet(const Fleet &fleet);
65  Fleet& operator=(const Fleet &fleet);
66 
67  void set_compatibles(const PD_Orders &orders);
68 
69  bool is_fleet_ok() const;
70  bool is_order_ok(const Order &order) const;
71 
73  Vehicle_pickDeliver get_truck(size_t order);
74 
78  size_t size() const {return m_trucks.size();}
80  iterator begin() {return m_trucks.begin();}
81  iterator end() {return m_trucks.end();}
82 
85  friend std::ostream& operator << (std::ostream &log, const Fleet &v);
86 
87  private:
88  std::vector<Vehicle_pickDeliver> m_trucks;
91 
96  bool build_fleet(
97  std::vector<Vehicle_t> vehicles,
98  double factor);
99 
100  void add_vehicle(
101  Vehicle_t,
102  double factor,
103  const Vehicle_node&,
104  const Vehicle_node&);
105 
107  static Pgr_messages& msg() ;
108 
111 
112 };
113 
114 
115 } // namespace vrp
116 } // namespace pgrouting
117 
118 #endif // INCLUDE_VRP_FLEET_H_
pgrouting::Pgr_messages
Definition: pgr_messages.h:39
pgrouting::vrp::Fleet::m_used
Identifiers< size_t > m_used
Definition: fleet.h:89
pgrouting::vrp::Fleet::operator=
Fleet & operator=(const Fleet &fleet)
Definition: fleet.cpp:299
pgrouting::vrp::Fleet
Definition: fleet.h:47
pgrouting::vrp::Fleet::problem
static Pgr_pickDeliver * problem
The problem.
Definition: fleet.h:110
pgrouting::vrp::Fleet::is_order_ok
bool is_order_ok(const Order &order) const
Given an order, Cycle trhugh all the trucks to verify if the order can be served by at least one truc...
Definition: fleet.cpp:288
pgrouting::vrp::Fleet::m_un_used
Identifiers< size_t > m_un_used
Definition: fleet.h:90
pgrouting::vrp::Fleet::add_vehicle
void add_vehicle(Vehicle_t, double factor, const Vehicle_node &, const Vehicle_node &)
Definition: fleet.cpp:122
pgrouting::vrp::Vehicle_node
Extend Tw_node to evaluate the vehicle at node level.
Definition: vehicle_node.h:48
pgrouting::vrp::Fleet::is_fleet_ok
bool is_fleet_ok() const
Definition: fleet.cpp:253
Vehicle_t
Definition: vehicle_t.h:40
pgrouting::vrp::Fleet::begin
iterator begin()
Definition: fleet.h:80
pgrouting::vrp::Fleet::msg
static Pgr_messages & msg()
the problem message
Definition: fleet.cpp:46
pgrouting::vrp::Vehicle_pickDeliver
Definition: vehicle_pickDeliver.h:47
pgrouting::vrp::Fleet::end
iterator end()
Definition: fleet.h:81
pgrouting::vrp::Pgr_pickDeliver
Definition: pgr_pickDeliver.h:57
pgrouting::vrp::Fleet::iterator
std::vector< Vehicle_pickDeliver >::iterator iterator
Definition: fleet.h:51
pgrouting::vrp::Fleet::m_trucks
std::vector< Vehicle_pickDeliver > m_trucks
Definition: fleet.h:88
vehicle_pickDeliver.h
pgrouting::vrp::Order
Definition: order.h:42
pgrouting::vrp::Fleet::get_truck
Vehicle_pickDeliver get_truck()
Definition: fleet.cpp:67
pgrouting::vrp::Fleet::operator<<
friend std::ostream & operator<<(std::ostream &log, const Fleet &v)
Definition: fleet.cpp:324
pgrouting::vrp::Fleet::size
size_t size() const
Definition: fleet.h:78
pgrouting::vrp::PD_Orders
Definition: pd_orders.h:48
pgrouting::vrp::Fleet::Fleet
Fleet()=default
pd_problem.h
pgrouting::vrp::Fleet::set_compatibles
void set_compatibles(const PD_Orders &orders)
Definition: fleet.cpp:313
pgrouting::vrp::PD_problem
Definition: pd_problem.h:42
pgrouting::vrp::Fleet::operator[]
Vehicle_pickDeliver & operator[](size_t i)
Definition: fleet.cpp:307
pgrouting
Book keeping class for swapping orders between vehicles.
Definition: pgr_alphaShape.cpp:56
pgrouting::vrp::Fleet::build_fleet
bool build_fleet(std::vector< Vehicle_t > vehicles, double factor)
build the fleet
Definition: fleet.cpp:160
identifiers.hpp
Identifiers< size_t >