wedding-planner/app/jobs/table_simulator_job.rb
Manuel Bustillo 1fcca38576
All checks were successful
Check usage of free licenses / build-static-assets (pull_request) Successful in 51s
Run unit tests / unit_tests (pull_request) Successful in 2m11s
Add copyright notice / copyright_notice (pull_request) Successful in 56s
Implement shift perturbation
2024-11-10 17:53:52 +01:00

24 lines
546 B
Ruby

# Copyright (C) 2024 Manuel Bustillo
class TableSimulatorJob < ApplicationJob
queue_as :default
def perform(*_args)
engine = VNS::Engine.new
engine.add_perturbation(Tables::Swap)
engine.add_perturbation(Tables::Shift)
initial_solution = Tables::Distribution.new(min_per_table: 8, max_per_table: 10)
initial_solution.random_distribution(Guest.potential.shuffle)
engine.initial_solution = initial_solution
engine.target_function(&:discomfort)
best_solution = engine.run
best_solution.save!
end
end