wedding-planner/app/jobs/table_simulator_job.rb
Manuel Bustillo 86e982164d
Some checks failed
Build Nginx-based docker image / build-static-assets (pull_request) Waiting to run
Run unit tests / unit_tests (pull_request) Failing after 16m52s
Add copyright notice / copyright_notice (pull_request) Failing after 17m30s
Add copyright notice
2024-11-03 08:31:58 +00:00

23 lines
503 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.potential.shuffle)
engine.initial_solution = initial_solution
engine.target_function(&:discomfort)
best_solution = engine.run
best_solution.save!
end
end