Skip to content

Commit

Permalink
Some formatting changes
Browse files Browse the repository at this point in the history
  • Loading branch information
cvvergara committed Aug 25, 2024
1 parent 9d8dc18 commit b33fcd0
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 50 deletions.
2 changes: 1 addition & 1 deletion doxygen/Doxyfile.in
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,7 @@ WARN_FORMAT = "$file:$line: $text"
# messages should be written. If left blank the output is written to standard
# error (stderr).

WARN_LOGFILE = @CMAKE_CURRENT_BIN_DIR@/LOG
WARN_LOGFILE = @CMAKE_CURRENT_BINARY_DIR@/LOG

#---------------------------------------------------------------------------
# Configuration options related to the input files
Expand Down
34 changes: 11 additions & 23 deletions src/compatibleVehicles/compatibleVehicles_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,14 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

#include "c_types/compatibleVehicles_rt.h"

#include "cpp_common/assert.hpp"
#include "cpp_common/alloc.hpp"
#include "cpp_common/assert.hpp"

#include "cpp_common/orders_t.hpp"
#include "cpp_common/vehicle_t.hpp"
#include "problem/pickDeliver.hpp"
#include "problem/matrix.hpp"


/**
*
* @param[in] customers_arr A C Array of pickup and dropoff orders
Expand All @@ -54,6 +53,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* @param[in] multipliers_arr A C Array of the multipliers
* @param[in] total_multipliers size of the multipliers_arr
* @param[in] factor A global multiplier for the (time) matrix cells
*
* @param[out] return_tuples C array of contents to be returned to postgres
* @param[out] return_count number of tuples returned
* @param[out] log_msg special log message pointer
Expand All @@ -65,48 +65,37 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* @pre The C array: return_tuples must be empty
* @pre Only matrix cells (i, i) can be missing and are considered as 0 (time units)
*
* @post The C arrays: customers_arr, vehicles_arr, matrix_cells_arr Do not change
* @post The C array: return_tuples contains the result for the problem given
* @post The return_tuples array size is return_count
* @post The return_tuples array size is return_count
* @post err_msg is empty if no throw from the process is catched
* @post log_msg contains some logging
* @post notice_msg is empty
*
*
@dot
digraph G {
node[fontsize=11, nodesep=0.75,ranksep=0.75];
start [shape=Mdiamond];
n1 [label="Verify preconditions",shape=rect];
n3 [label="Verify matrix cells preconditions",shape=rect];
n3 [label="Verify matrix preconditions",shape=rect];
n4 [label="Construct problem",shape=cds,color=blue];
n7 [label="Prepare results",shape=rect];
end [shape=Mdiamond];
error [shape=Mdiamond,color=red]
start -> n1 -> n3 -> n4 -> n7 -> end;
n1 -> error [ label="Caller error",color=red];
n3 -> error [ label="User error",color=red];
n1 -> error [ label="throw",color=red];
n3 -> error [ label="throw",color=red];
}
@enddot
*
*/
void
vrp_do_compatibleVehicles(
Orders_t customers_arr[],
size_t total_customers,

Vehicle_t *vehicles_arr,
size_t total_vehicles,

Matrix_cell_t *matrix_cells_arr,
size_t total_cells,

Time_multipliers_t *multipliers_arr,
size_t total_multipliers,
Orders_t customers_arr[], size_t total_customers,
Vehicle_t *vehicles_arr, size_t total_vehicles,
Matrix_cell_t *matrix_cells_arr, size_t total_cells,
Time_multipliers_t *multipliers_arr, size_t total_multipliers,

double factor,

Expand Down Expand Up @@ -193,9 +182,8 @@ vrp_do_compatibleVehicles(

err << pd_problem.msg.get_error();
if (!err.str().empty()) {
log << pd_problem.msg.get_log();
*log_msg = to_pg_msg(log.str());
*err_msg = to_pg_msg(err.str());
*log_msg = to_pg_msg(pd_problem.msg.get_log());
*err_msg = to_pg_msg(pd_problem.msg.get_error());
return;
}
log << pd_problem.msg.get_log();
Expand Down
12 changes: 6 additions & 6 deletions src/optimize/optimize_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

#include "cpp_common/alloc.hpp"
#include "cpp_common/assert.hpp"

#include "cpp_common/interruption.hpp"
#include "cpp_common/messages.hpp"

Expand All @@ -52,12 +53,15 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

namespace {

using Short_vehicle = vrprouting::Short_vehicle;

/** @brief Executes an optimization with the input data
*
* @param[in] shipments_arr A C Array of pickup and dropoff shipments
* @param[in] total_shipments size of the shipments_arr
* @param[in] vehicles_arr A C Array of vehicles
* @param[in] total_vehicles size of the vehicles_arr
*
* @param[in] new_stops stops that override the original stops.
* @param[in] time_matrix The unique time matrix
* @param[in] max_cycles number of cycles to perform during the optimization phase
Expand Down Expand Up @@ -292,26 +296,24 @@ subdivide_processing(
* @param[in] total_cells size of the matrix_cells_arr
* @param[in] multipliers_arr A C Array of the multipliers
* @param[in] total_multipliers size of the multipliers_arr
*
* @param[in] factor A global multiplier for the (time) matrix cells
* @param[in] max_cycles number of cycles to perform during the optimization phase
* @param[in] check_triangle_inequality When true tirangle inequality will be checked
* @param[in] subdivide @todo
* @param[in] subdivide_by_vehicle @todo
* @param[in] execution_date Value used for not moving shipments that are before this date
*
* @param[out] return_tuples C array of contents to be returned to postgres
* @param[out] return_count number of tuples returned
* @param[out] log_msg special log message pointer
* @param[out] notice_msg special message pointer to be returned as NOTICE
* @param[out] err_msg special message pointer to be returned as ERROR
* @return void
*
*
* @pre The messages: log_msg, notice_msg, err_msg must be empty (=nullptr)
* @pre The C arrays: shipments_arr, vehicles_arr, matrix_cells_arr must not be empty
* @pre The C array: return_tuples must be empty
* @pre Only matrix cells (i, i) can be missing and are considered as 0 (time units)
*
* @post The C arrays: shipments_arr, vehicles_arr, matrix_cells_arr Do not change
* @post The C array: return_tuples contains the result for the problem given
* @post The return_tuples array size is return_count
* @post err_msg is empty if no throw from the process is catched
Expand All @@ -338,8 +340,6 @@ subdivide_processing(
}
@enddot
*
*/
void
vrp_do_optimize(
Expand Down
1 change: 1 addition & 0 deletions src/pgr_pickDeliver/pgr_pickDeliverEuclidean_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#include "problem/pickDeliver.hpp"

namespace {

vrprouting::problem::Solution
get_initial_solution(vrprouting::problem::PickDeliver* problem_ptr, int m_initial_id) {
using Solution = vrprouting::problem::Solution;
Expand Down
14 changes: 5 additions & 9 deletions src/pickDeliver/pickDeliver_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

#include "cpp_common/alloc.hpp"
#include "cpp_common/assert.hpp"
#include "cpp_common/timeconversion.hpp"

#include "cpp_common/orders_t.hpp"
#include "cpp_common/vehicle_t.hpp"
Expand Down Expand Up @@ -67,8 +68,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* @param[out] log_msg special log message pointer
* @param[out] notice_msg special message pointer to be returned as NOTICE
* @param[out] err_msg special message pointer to be returned as ERROR
* @return void
*
*
* @pre The messages: log_msg, notice_msg, err_msg must be empty (=nullptr)
* @pre The C arrays: customers_arr, vehicles_arr, matrix_cells_arr must not be empty
Expand All @@ -82,7 +81,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* @post log_msg contains some logging
* @post notice_msg is empty
*
*
@dot
digraph G {
node[fontsize=11, nodesep=0.75,ranksep=0.75];
Expand All @@ -102,8 +100,6 @@ digraph G {
}
@enddot
*
*/
void
vrp_do_pickDeliver(
Expand Down Expand Up @@ -152,9 +148,10 @@ vrp_do_pickDeliver(
Identifiers<Id> order_ids;

for (size_t i = 0; i < total_customers; ++i) {
node_ids += customers_arr[i].pick_node_id;
node_ids += customers_arr[i].deliver_node_id;
order_ids += customers_arr[i].id;
auto o = customers_arr[i];
node_ids += o.pick_node_id;
node_ids += o.deliver_node_id;
order_ids += o.id;
}

bool missing = false;
Expand Down Expand Up @@ -240,7 +237,6 @@ vrp_do_pickDeliver(
using Optimize = vrprouting::optimizers::tabu::Optimize;
sol = Optimize(sol, static_cast<size_t>(max_cycles), stop_on_all_served, optimize);


log << pd_problem.msg.get_log();
pd_problem.msg.clear();
log << "Finish solve\n";
Expand Down
19 changes: 8 additions & 11 deletions src/vroom/vroom_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

/** @file vroom_driver.cpp
* @brief Handles actual calling of function in the `vrp_vroom.hpp` file.
*
*/

/** @brief Performs exception handling and converts the results to postgres.
Expand Down Expand Up @@ -79,9 +78,11 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* @param[in] total_breaks_tws The total number of total breaks timewindows
* @param[in] matrix_rows Pointer to the array of matrix rows
* @param[in] total_matrix_rows The total number of matrix rows
*
* @param[in] exploration_level Exploration level to use while solving.
* @param[in] timeout Timeout value to stop the solving process (seconds).
* @param[in] loading_time Additional time spent in loading the data from SQL Query (seconds).
*
* @param[out] return_tuples The rows in the result
* @param[out] return_count The count of rows in the result
* @param[out] log_msg Stores the log message
Expand All @@ -106,9 +107,9 @@ vrp_do_vroom(
Vroom_rt **return_tuples,
size_t *return_count,

char ** log_msg,
char ** notice_msg,
char ** err_msg) {
char **log_msg,
char **notice_msg,
char **err_msg) {
using vrprouting::alloc;
using vrprouting::free;
using vrprouting::to_pg_msg;
Expand Down Expand Up @@ -200,13 +201,9 @@ vrp_do_vroom(

vrprouting::problem::Vroom problem;
problem.add_matrix(matrix);
problem.add_vehicles(vehicles, total_vehicles,
breaks, total_breaks,
breaks_tws, total_breaks_tws);
problem.add_jobs(jobs, total_jobs,
jobs_tws, total_jobs_tws);
problem.add_shipments(shipments, total_shipments,
shipments_tws, total_shipments_tws);
problem.add_vehicles(vehicles, total_vehicles, breaks, total_breaks, breaks_tws, total_breaks_tws);
problem.add_jobs(jobs, total_jobs, jobs_tws, total_jobs_tws);
problem.add_shipments(shipments, total_shipments, shipments_tws, total_shipments_tws);

auto end_time = std::chrono::high_resolution_clock::now();
loading_time += static_cast<int32_t>(
Expand Down

0 comments on commit b33fcd0

Please sign in to comment.