Class: ORTools::RoutingModel
- Inherits:
-
Object
- Object
- ORTools::RoutingModel
- Defined in:
- lib/or_tools/routing_model.rb
Instance Method Summary collapse
- #add_disjunction(indices, penalty, max_cardinality = 1, penalty_cost_behavior = :penalize_once) ⇒ Object
- #register_transit_callback(callback) ⇒ Object
- #register_unary_transit_callback(callback) ⇒ Object
- #solve(solution_limit: nil, time_limit: nil, lns_time_limit: nil, first_solution_strategy: nil, local_search_metaheuristic: nil, log_search: nil) ⇒ Object
- #solve_from_assignment_with_parameters(assignment, search_parameters) ⇒ Object
- #solve_with_parameters(search_parameters) ⇒ Object
Instance Method Details
#add_disjunction(indices, penalty, max_cardinality = 1, penalty_cost_behavior = :penalize_once) ⇒ Object
21 22 23 |
# File 'lib/or_tools/routing_model.rb', line 21 def add_disjunction(indices, penalty, max_cardinality = 1, penalty_cost_behavior = :penalize_once) _add_disjunction(indices, penalty, max_cardinality, penalty_cost_behavior) end |
#register_transit_callback(callback) ⇒ Object
38 39 40 41 |
# File 'lib/or_tools/routing_model.rb', line 38 def register_transit_callback(callback) @ruby_callback = true _register_transit_callback(callback) end |
#register_unary_transit_callback(callback) ⇒ Object
33 34 35 36 |
# File 'lib/or_tools/routing_model.rb', line 33 def register_unary_transit_callback(callback) @ruby_callback = true _register_unary_transit_callback(callback) end |
#solve(solution_limit: nil, time_limit: nil, lns_time_limit: nil, first_solution_strategy: nil, local_search_metaheuristic: nil, log_search: nil) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/or_tools/routing_model.rb', line 3 def solve( solution_limit: nil, time_limit: nil, lns_time_limit: nil, first_solution_strategy: nil, local_search_metaheuristic: nil, log_search: nil ) search_parameters = ORTools.default_routing_search_parameters search_parameters.solution_limit = solution_limit if solution_limit search_parameters.time_limit = time_limit if time_limit search_parameters.lns_time_limit = lns_time_limit if lns_time_limit search_parameters.first_solution_strategy = first_solution_strategy if first_solution_strategy search_parameters. = if search_parameters.log_search = log_search unless log_search.nil? solve_with_parameters(search_parameters) end |
#solve_from_assignment_with_parameters(assignment, search_parameters) ⇒ Object
29 30 31 |
# File 'lib/or_tools/routing_model.rb', line 29 def solve_from_assignment_with_parameters(assignment, search_parameters) _solve_from_assignment_with_parameters(assignment, search_parameters, !@ruby_callback) end |
#solve_with_parameters(search_parameters) ⇒ Object
25 26 27 |
# File 'lib/or_tools/routing_model.rb', line 25 def solve_with_parameters(search_parameters) _solve_with_parameters(search_parameters, !@ruby_callback) end |