@@ -15,6 +15,7 @@ using operations_research::RoutingModel;
1515using operations_research::RoutingModelParameters;
1616using operations_research::RoutingNodeIndex;
1717using operations_research::RoutingSearchParameters;
18+ using operations_research::RoutingSearchStatus;
1819
1920using Rice::Array;
2021using Rice::Class;
@@ -331,7 +332,7 @@ void init_routing(Rice::Module& m) {
331332 .define_method (" add_resource_group" , &RoutingModel::AddResourceGroup)
332333 .define_method (" dimension_resource_group_indices" , &RoutingModel::GetDimensionResourceGroupIndices)
333334 .define_method (" dimension_resource_group_index" , &RoutingModel::GetDimensionResourceGroupIndex)
334- .define_method (" add_disjunction" , &RoutingModel::AddDisjunction, Rice::Arg (" _indices" ), Rice::Arg (" _penalty" ), Rice::Arg (" _max_cardinality" ) = (int64_t )1 )
335+ .define_method (" add_disjunction" , &RoutingModel::AddDisjunction, Rice::Arg (" _indices" ), Rice::Arg (" _penalty" ), Rice::Arg (" _max_cardinality" ) = (int64_t )1 , Rice::Arg ( " _penalty_cost_behavior " ) = RoutingModel::PenaltyCostBehavior::PENALIZE_ONCE )
335336 .define_method (" disjunction_indices" , &RoutingModel::GetDisjunctionIndices)
336337 .define_method (" disjunction_penalty" , &RoutingModel::GetDisjunctionPenalty)
337338 .define_method (" disjunction_max_cardinality" , &RoutingModel::GetDisjunctionMaxCardinality)
@@ -346,22 +347,14 @@ void init_routing(Rice::Module& m) {
346347 .define_method (" add_pickup_and_delivery" , &RoutingModel::AddPickupAndDelivery)
347348 .define_method (" add_pickup_and_delivery_sets" , &RoutingModel::AddPickupAndDeliverySets)
348349 .define_method (
349- " pickup_positions " ,
350+ " pickup_position " ,
350351 [](RoutingModel& self, int64_t node_index) {
351- std::vector<std::pair<int , int >> positions;
352- for (const auto & v : self.GetPickupPositions (node_index)) {
353- positions.emplace_back (v.pd_pair_index , v.alternative_index );
354- }
355- return positions;
352+ return self.GetPickupPosition (node_index);
356353 })
357354 .define_method (
358- " delivery_positions " ,
355+ " delivery_position " ,
359356 [](RoutingModel& self, int64_t node_index) {
360- std::vector<std::pair<int , int >> positions;
361- for (const auto & v : self.GetDeliveryPositions (node_index)) {
362- positions.emplace_back (v.pd_pair_index , v.alternative_index );
363- }
364- return positions;
357+ return self.GetDeliveryPosition (node_index);
365358 })
366359 .define_method (" num_of_singleton_nodes" , &RoutingModel::GetNumOfSingletonNodes)
367360 .define_method (" unperformed_penalty" , &RoutingModel::UnperformedPenalty)
@@ -403,15 +396,15 @@ void init_routing(Rice::Module& m) {
403396 [](RoutingModel& self) {
404397 auto status = self.status ();
405398
406- if (status == RoutingModel ::ROUTING_NOT_SOLVED) {
399+ if (status == RoutingSearchStatus ::ROUTING_NOT_SOLVED) {
407400 return Symbol (" not_solved" );
408- } else if (status == RoutingModel ::ROUTING_SUCCESS) {
401+ } else if (status == RoutingSearchStatus ::ROUTING_SUCCESS) {
409402 return Symbol (" success" );
410- } else if (status == RoutingModel ::ROUTING_FAIL) {
403+ } else if (status == RoutingSearchStatus ::ROUTING_FAIL) {
411404 return Symbol (" fail" );
412- } else if (status == RoutingModel ::ROUTING_FAIL_TIMEOUT) {
405+ } else if (status == RoutingSearchStatus ::ROUTING_FAIL_TIMEOUT) {
413406 return Symbol (" fail_timeout" );
414- } else if (status == RoutingModel ::ROUTING_INVALID) {
407+ } else if (status == RoutingSearchStatus ::ROUTING_INVALID) {
415408 return Symbol (" invalid" );
416409 } else {
417410 throw std::runtime_error (" Unknown solver status" );
0 commit comments