module Solve

def engine=(selected_engine)

Raises:
  • (Solve::Errors::InvalidEngine) - when `selected_engine` is invalid.
  • (Solve::Errors::EngineNotAvailable) - when the selected engine's deps aren't installed.

Returns:
  • (Symbol) - selected_engine

Parameters:
  • selected_engine (Symbol) --
def engine=(selected_engine)
  engine_class = solver_for_engine(selected_engine)
  if engine_class.nil?
    raise Errors::InvalidEngine, "Engine `#{selected_engine}` is not supported. Valid values are `:ruby`, `:gecode`"
  else
    engine_class.activate
  end
  @engine = selected_engine
end

def it!(graph, demands, options = {})

Returns:
  • (Hash) -

Raises:
  • (NoSolutionError) -

Options Hash: (**options)
  • :sorted (Boolean) --

Parameters:
  • demands (Array, Array) --
  • graph (Solve::Graph) --
def it!(graph, demands, options = {})
  solver_for_engine(engine).new(graph, demands, options).resolve(options)
end

def solver_for_engine(engine_name)

def solver_for_engine(engine_name)
  case engine_name
  when :ruby
    RubySolver
  when :gecode
    GecodeSolver
  end
end