Manuel Bustillo
8c4e6a0109
All checks were successful
Run unit tests / unit_tests (push) Successful in 3m36s
Reviewed-on: #8 Co-authored-by: Manuel Bustillo <bustikiller@bustikiller.com> Co-committed-by: Manuel Bustillo <bustikiller@bustikiller.com>
19 lines
435 B
Ruby
19 lines
435 B
Ruby
namespace :vns 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
|