Initial version of VNS algorithm #8

Merged
bustikiller merged 20 commits from vns into main 2024-08-01 18:27:42 +00:00
Showing only changes of commit 41589af738 - Show all commits

View File

@ -139,6 +139,20 @@ module Tables
expect(calculator.send(:cohesion_penalty)).to eq(4 * 1 + 4 * Rational(1, 2) + 4 * Rational(2, 3)) expect(calculator.send(:cohesion_penalty)).to eq(4 * 1 + 4 * Rational(1, 2) + 4 * Rational(2, 3))
end end
end end
context 'when the table contains six guests of three unevenly split groups' do
let(:table) do
[
create_list(:guest, 3, affinity_group_list: ['family']),
create_list(:guest, 2, affinity_group_list: ['friends']),
create_list(:guest, 1, affinity_group_list: ['work'])
].flatten
end
it 'returns the sum of the penalties for each pair of guests' do
expect(calculator.send(:cohesion_penalty)).to eq(6 * 1 + 2 * Rational(1, 2) + 3 * Rational(2, 3))
end
end
end end
end end
end end