Sha256: 93e3995231e1d20c9f1af452ef02c35955f572f7e20c304c46dac9d2296fe341
Contents?: true
Size: 563 Bytes
Versions: 1
Compression:
Stored size: 563 Bytes
Contents
# frozen_string_literal: true module SportsManager module Constraints # Public: Constraint to all timeslot assignments be different for # each match class AllDifferentConstraint < ::CSP::Constraint attr_reader :matches def self.for_tournament(tournament:, csp:) csp.add_constraint(new(tournament.matches.values.flatten)) end def initialize(matches) super @matches = matches end def satisfies?(assignment) assignment.values == assignment.values.uniq end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sports-manager-0.0.1 | lib/sports_manager/constraints/all_different_constraint.rb |