Class: ORTools::CpSolver

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/or_tools/cp_solver.rb

Instance Method Summary collapse

Instance Method Details

#parametersObject



32
33
34
# File 'lib/or_tools/cp_solver.rb', line 32

def parameters
  @parameters ||= SatParameters.new
end

#search_for_all_solutions(model, observer) ⇒ Object



27
28
29
30
# File 'lib/or_tools/cp_solver.rb', line 27

def search_for_all_solutions(model, observer)
  @response = _solve_with_observer(model, parameters, observer, true)
  @response.status
end

#solve(model) ⇒ Object



9
10
11
12
# File 'lib/or_tools/cp_solver.rb', line 9

def solve(model)
  @response = _solve(model, parameters)
  @response.status
end

#solve_with_solution_callback(model, observer) ⇒ Object



22
23
24
25
# File 'lib/or_tools/cp_solver.rb', line 22

def solve_with_solution_callback(model, observer)
  @response = _solve_with_observer(model, parameters, observer, false)
  @response.status
end

#value(var) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/or_tools/cp_solver.rb', line 14

def value(var)
  if var.is_a?(BoolVar)
    _solution_boolean_value(@response, var)
  else
    _solution_integer_value(@response, var)
  end
end