Define a job to generate table simulations
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 6m46s
Run unit tests / unit_tests (pull_request) Successful in 9m49s

This commit is contained in:
Manuel Bustillo 2024-11-03 09:05:51 +01:00
parent 8d83c63fa6
commit 1f919644a3
2 changed files with 21 additions and 14 deletions

View File

@ -0,0 +1,20 @@
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

View File

@ -1,18 +1,5 @@
namespace :vns do namespace :vns do
task distribute_tables: :environment do task distribute_tables: :environment do
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
end end