21 lines
459 B
Ruby
21 lines
459 B
Ruby
class TableSimulatorJob < ApplicationJob
|
|
queue_as :default
|
|
|
|
def perform(*_args)
|
|
engine = VNS::Engine.new
|
|
|
|
engine.add_perturbation(Tables::Swap)
|
|
|
|
initial_solution = Tables::Distribution.new(min_per_table: 8, max_per_table: 10)
|
|
initial_solution.random_distribution(Guest.all.shuffle)
|
|
|
|
engine.initial_solution = initial_solution
|
|
|
|
engine.target_function(&:discomfort)
|
|
|
|
best_solution = engine.run
|
|
|
|
best_solution.save!
|
|
end
|
|
end
|