Skip to content

Commit

Permalink
Merge pull request #790 from cvvergara/release/2.5
Browse files Browse the repository at this point in the history
pick delivery
  • Loading branch information
cvvergara authored May 17, 2017
2 parents e9985ab + c734cc8 commit afdd5d4
Show file tree
Hide file tree
Showing 85 changed files with 1,865 additions and 4,668 deletions.
3 changes: 1 addition & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,7 @@ set(PgRouting_SOURCE_NAMES
#----------------------
"max_flow" # 2.3
"contraction" # 2.3
#"pickDeliver" # 2.3
"pickDeliverE" # 2.5
"pickDeliver" # 2.3
"vrp_basic" # 2.0
"withPoints" # 2.2

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5332-de02a9548 vrppdtw/docfix
5332-de02a9548 release/2.5
3 changes: 0 additions & 3 deletions doc/conf.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,6 @@ gettext_compact = False
exclude_patterns = [
'doc/build',
'pgr_withPointsVia.rst',
'pgr_pickDeliver.rst',
'pgr_pickDeliverEuclidean.rst',
'src/pickDeliver',
'maxFlowApplications.rst',
'*/notUsed',
'tools/template'
Expand Down
21 changes: 0 additions & 21 deletions doc/src/pgRouting-concepts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -354,20 +354,6 @@ Where:
.. points_sql_end


.. pd_euclidean_sql_start

.. note TODO

.. pd_euclidean_sql_end

.. pd_vehicle_sql_start

.. note TODO

.. pd_vehicle_sql_end



.. _return_values:

Return columns & values
Expand Down Expand Up @@ -435,13 +421,6 @@ Column Type Description

.. result_flow_end

.. return_vrp_start

.. note:: TODO

.. return_vrp_end


.. _advanced_topics:

Advanced Topics
Expand Down
18 changes: 5 additions & 13 deletions doc/src/proposed.rst
Original file line number Diff line number Diff line change
Expand Up @@ -138,26 +138,20 @@ Experimental and Proposed functions

- :ref:`pgr_labelGraph` - Analyze / label subgraphs within a network

.. rubric:: Vehicle Routing Problems

- :ref:`pgr_gsocvrppdtw` - VRP Pickup & Delivery (Euclidean)
- :ref:`pgr_vrp_basic` - VRP One Depot
:ref:`VRP`

.. TODO deprecate pgr_gsocvrppdtw
.. include:: VRP-category.rst
:start-after: index from here
:end-before: index to here

.. toctree::
:hidden:

contraction-family
flow-family
pgr_labelGraph
pgr_gsoc_vrppdtw
pgr_vrpOneDepot





VRP-category



Expand All @@ -169,6 +163,4 @@ Experimental and Proposed functions
:hidden:
..
../src/funnyDijkstra/doc/pgr_funnyDijkstra.rst
- :ref:`pgr_pickDeliverEuclidean` - VRP Pickup & Delivery with Euclidean distances
pgr_pickDeliverEuclidean
2 changes: 1 addition & 1 deletion doxygen/Doxyfile.in
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,7 @@ EXCLUDE_SYMLINKS = NO
# Note that the wildcards are matched against the file with absolute path, so to
# exclude all test directories for example use the pattern */test/*

EXCLUDE_PATTERNS = */notUsed/* */test/* */src/trsp/doc/README.md */pickDeliver/*
EXCLUDE_PATTERNS = */notUsed/* */test/* */src/trsp/doc/README.md

# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
# (namespaces, classes, functions, etc.) that should be excluded from the
Expand Down
3 changes: 3 additions & 0 deletions include/cpp_common/Dmatrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ class Dmatrix {
double comparable_distance(size_t i, size_t j) const {
return distance(i, j);}

double distance(int64_t i, int64_t j) const {
return distance(get_index(i), get_index(j));}

double distance(size_t i, size_t j) const {
return costs[i][j];}

Expand Down
1 change: 1 addition & 0 deletions include/drivers/pickDeliver/pickDeliver_driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ extern "C" {
Vehicle_t *vehicles_arr, size_t total_vehicles,
Matrix_cell_t *matrix_cells_arr, size_t total_cells,

double factor,
int max_cycles,
int initial_solution_id,

Expand Down
28 changes: 11 additions & 17 deletions include/pickDeliver/dnode.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,42 +30,36 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#pragma once

#include <string>
#include <ostream>
#include "pickDeliver/base_node.h"
#include "pickDeliver/pd_problem.h"
#include <iosfwd>
#include "vrp/base_node.h"
#include "vrp/pd_problem.h"

namespace pgrouting {
namespace vrp {
namespace pickdeliver {

/*! @class Dnode
* @brief The Dnode class defines a the operations when its a matrix.
* @brief The Dnode class defines a the basic operations when data is a matrix.
*
* currently needs the PD_problem
*/

class Dnode : public Base_node, public PD_problem {
public:
/*! @name constructors
* @{
*/
Dnode() = default;
/*! @brief data constructor */
Dnode(size_t id, int64_t original_id, double, double);
/*!@}*/


using Base_node::isSamePos;
using Base_node::operator==;
/*! @name to be or not to be
@{
bool isSamePos(const Dnode &other) const;
bool operator==(const Dnode &rhs) const;
@}*/

double distance(const Dnode &other) const;
double distance(const Base_node &) const;

double comparable_distance(const Dnode &other) const;
double distance(const Base_node *) const;

friend std::ostream& operator << (std::ostream &log, const Dnode &node);
};

} // namespace pickdeliver
} // namespace vrp
} // namespace pgrouting

Expand Down
41 changes: 7 additions & 34 deletions include/vrp/base_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,19 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

/*! @file */

#ifndef INCLUDE_PICKDELIVER_BASE_NODE_H_
#define INCLUDE_PICKDELIVER_BASE_NODE_H_
#ifndef INCLUDE_VRP_BASE_NODE_H_
#define INCLUDE_VRP_BASE_NODE_H_
#pragma once

#include <string>
#include <ostream>
#include <memory>
#include <iosfwd>
#include "cpp_common/identifier.h"
#include "vrp/pd_problem.h"

#if defined(__MINGW32__) || defined(_MSC_VER)
#include <stdint.h>
#endif

namespace pgrouting {
namespace vrp {
namespace pickdeliver {

/*! \class Base_node
* \brief The Base_node class defines the operations that can be performed in a 2D node.
Expand All @@ -50,27 +46,13 @@ namespace pickdeliver {
*/
class Base_node : public Identifier {
public:
/*! @name accessors
@{
*/

#if 0
/*! @brief Returns the idx */
size_t idx() const;

/*! @brief Returns the original id */
int64_t id() const;
#endif
///@}

Base_node() = default;
Base_node(size_t, int64_t);


/** @name to be or not to be */
///@ {
/*!@{*/

virtual bool isSamePos(const Base_node &other) const;
virtual bool operator ==(const Base_node &rhs) const;

/*!@}*/
Expand All @@ -82,24 +64,15 @@ class Base_node : public Identifier {
/*! @name distance
@{
*/
#if 1
virtual double distance(const Base_node &node) const = 0;
#endif
virtual double comparable_distance(const Base_node &other) const;
virtual double distance(const Base_node *node) const = 0;
/*!@}*/


private:
virtual void print(std::ostream& os) const;

protected:
#if 0
size_t m_idx; ///< internal node number
int64_t m_id; ///< user supplied node number
#endif
};

} // namespace pickdeliver
} // namespace vrp
} // namespace pgrouting

#endif // INCLUDE_PICKDELIVER_BASE_NODE_H_
#endif // INCLUDE_VRP_BASE_NODE_H_
53 changes: 37 additions & 16 deletions include/vrp/fleet.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,16 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#define INCLUDE_VRP_FLEET_H_
#pragma once

#include <deque>
#include <tuple>
#include <string>
#include <iosfwd>
#include <vector>
#include <memory>
#include <utility>

#include "cpp_common/identifiers.hpp"

#include "vrp/vehicle_pickDeliver.h"
#include "vrp/pd_problem.h"

#include "vrp/vehicle_pickDeliver.h"

namespace pgrouting {


namespace tsp {
class Dmatrix;
}
namespace vrp {

class Pgr_pickDeliver;
Expand All @@ -56,11 +49,6 @@ class Fleet : public PD_problem {
typedef std::vector<Vehicle_pickDeliver>::iterator iterator;
std::vector<Vehicle_pickDeliver> m_trucks;

protected:
Identifiers<size_t> used;
Identifiers<size_t> un_used;



public:
/*! @name constructor
Expand Down Expand Up @@ -104,13 +92,46 @@ class Fleet : public PD_problem {
friend std::ostream& operator << (std::ostream &log, const Fleet &v);

private:
Identifiers<size_t> used;
Identifiers<size_t> un_used;

/*! @brief build the fleet
*
* @param[in] vehicles of type Vehicle_t
*/
bool build_fleet(
std::vector<Vehicle_t> vehicles,
double factor);

void add_vehicle(
Vehicle_t,
double factor,
std::unique_ptr<Base_node>,
Vehicle_node,
std::unique_ptr<Base_node>,
Vehicle_node);

template <typename T> std::unique_ptr<Base_node> create_b_start(
const Vehicle_t &vehicle,
size_t node_id) {
std::unique_ptr<Base_node> b_start(new T(
node_id,
vehicle.start_node_id,
vehicle.start_x,
vehicle.start_y));
return std::move(b_start);
}

template <typename T> std::unique_ptr<Base_node> create_b_end(
const Vehicle_t &vehicle,
size_t node_id) {
std::unique_ptr<Base_node> b_end(new T(
node_id,
vehicle.end_node_id,
vehicle.end_x,
vehicle.end_y));
return std::move(b_end);
}
};


Expand Down
2 changes: 1 addition & 1 deletion include/vrp/initial_solution.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class Initial_solution : public Solution {

private:
Identifiers<size_t> all_orders;
Identifiers<PD_Orders::OID> unassigned;
Identifiers<size_t> unassigned;
Identifiers<size_t> assigned;
};

Expand Down
Loading

0 comments on commit afdd5d4

Please sign in to comment.