vrpRouting  0.3
order.h
Go to the documentation of this file.
1 /*PGR-GNU*****************************************************************
2 
3 FILE: order.h
4 
5 Copyright (c) 2015 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_PROBLEM_ORDER_H_
29 #define INCLUDE_PROBLEM_ORDER_H_
30 #pragma once
31 
32 
33 #include "cpp_common/identifier.h"
35 #include "problem/vehicle_node.h"
36 
37 namespace vrprouting {
38 namespace problem {
39 
40 class Order : public Identifier {
41  public:
43  friend std::ostream& operator << (std::ostream&, const Order &);
44 
46  Order() = delete;
47 
49  Order(const Order&) = default;
50 
52  Order(Idx o_idx, Id o_id,
53  const Vehicle_node &p_pickup,
54  const Vehicle_node &p_delivery) :
55  Identifier(o_idx, o_id),
56  m_pickup(p_pickup),
57  m_delivery(p_delivery) {
58  }
59 
65  const Vehicle_node& pickup() const {return m_pickup;}
66 
68  const Vehicle_node& delivery() const {return m_delivery;}
69 
72 
75 
79  void set_compatibles(const Order&, Speed speed = 1.0);
80 
82  bool is_valid(Speed speed = 1.0) const;
83 
85  bool isCompatibleIJ(const Order &I, Speed speed = 1.0) const;
86 
87  protected:
99 
111 
117 
123 };
124 
125 } // namespace problem
126 } // namespace vrprouting
127 
128 #endif // INCLUDE_PROBLEM_ORDER_H_
vrprouting::problem::Order::subsetI
Identifiers< size_t > subsetI(const Identifiers< size_t > &I) const
Get a subset of the orders that can be placed before this order.
Definition: order.cpp:45
vehicle_node.h
vrprouting::problem::Order::isCompatibleIJ
bool isCompatibleIJ(const Order &I, Speed speed=1.0) const
Can order I be placed before this order?
Definition: order.cpp:161
Speed
double Speed
Definition: typedefs.h:76
vrprouting::problem::Order::m_pickup
Vehicle_node m_pickup
The pick up node identifier.
Definition: order.h:116
Id
int64_t Id
Definition: typedefs.h:78
vrprouting::problem::Vehicle_node
Extend Tw_node to evaluate the vehicle at node level.
Definition: vehicle_node.h:49
identifier.h
vrprouting::problem::Order::m_delivery
Vehicle_node m_delivery
The delivery node identifier.
Definition: order.h:122
vrprouting::problem::Order::pickup
const Vehicle_node & pickup() const
The pickup node identifier.
Definition: order.h:65
vrprouting::problem::Order::Order
Order()=delete
Order without data is not permitted.
Idx
uint64_t Idx
Definition: typedefs.h:79
vrprouting::problem::Order::is_valid
bool is_valid(Speed speed=1.0) const
is the order valid?
Definition: order.cpp:109
vrprouting::problem::Order::Order
Order(Idx o_idx, Id o_id, const Vehicle_node &p_pickup, const Vehicle_node &p_delivery)
initializing an order with the pick & drop information
Definition: order.h:52
vrprouting::problem::Order::set_compatibles
void set_compatibles(const Order &, Speed speed=1.0)
set compatability of this orther with the other order
Definition: order.cpp:130
vrprouting::Identifier
Class that stores the information about identifiers.
Definition: identifier.h:65
vrprouting::problem::Order
Definition: order.h:40
vrprouting::problem::Order::operator<<
friend std::ostream & operator<<(std::ostream &, const Order &)
Print the order.
Definition: order.cpp:77
vrprouting::problem::Order::m_compatibleI
Identifiers< size_t > m_compatibleI
Storage for the orders that can be placed before this order.
Definition: order.h:110
vrprouting::problem::Order::delivery
const Vehicle_node & delivery() const
The delivery node identifier.
Definition: order.h:68
vrprouting::problem::Order::subsetJ
Identifiers< size_t > subsetJ(const Identifiers< size_t > &J) const
Get a subset of the orders that can be placed after this order.
Definition: order.cpp:62
vrprouting::problem::Order::m_compatibleJ
Identifiers< size_t > m_compatibleJ
Storage for the orders that can be placed after this order.
Definition: order.h:98
identifiers.hpp
Identifiers< size_t >
vrprouting
Definition: base_matrix.cpp:46