wedding-planner/app/jobs/table_simulator_job.rb
Manuel Bustillo 15a5c51fb6
Some checks are pending
Build Nginx-based docker image / build-static-assets (pull_request) Waiting to run
Add copyright notice / copyright_notice (pull_request) Successful in 6m50s
Run unit tests / unit_tests (pull_request) Successful in 10m9s
Add copyright notice
2024-11-03 08:12:24 +00:00

23 lines
497 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)
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