Change var ints to more restricted domains

This commit is contained in:
Nemo 2020-06-14 01:48:15 +05:30
parent 7a4bc6a1e9
commit f4df68533b
6 changed files with 8 additions and 11 deletions

View File

@ -10,7 +10,7 @@
% Whether an artist won an award in a given round
array[Rounds,Artists] of var bool: awards_per_round_per_artist;
array[Rounds,Artists] of var int: award_bonus_per_round_per_artist;
array[Rounds,Artists] of var {0,2}: award_bonus_per_round_per_artist;
% Total number of awards for each artist = 1
constraint forall(a in Artists) ( sum(col(awards_per_round_per_artist,a)) = 1 );

View File

@ -1,7 +1,7 @@
% This file deals with dealing of new cards every Round
% Usable variable from here is CardsDealtPerRound[Rounds]
array[Rounds] of var int: CardsDealtPerRound;
array[Rounds] of var 0..13: CardsDealtPerRound;
constraint CardsDealtPerRound[Round1] = 13;
constraint CardsDealtPerRound[Round2] =

View File

@ -34,7 +34,7 @@ constraint forall(r in Rounds) (max(row(CardsForArtist,r)) = MaxVisibleCards);
constraint forall(r in Rounds) (sort(row(CardsForArtist, r))[4] != MaxVisibleCards);
% Temporary variable to see how many cards you've played TOTAL per round
array[Rounds,Players] of var int: TotalCardsPlayed;
array[Rounds,Players] of var 1..20: TotalCardsPlayed;
constraint forall(r in Rounds, p in Players) (
% TODO: Change this to played cards from VISIBLE (hidden)
TotalCardsPlayed[r,p] = sum(a in Artists) (visible_count_per_round_per_artist_per_player[r,p,a])

View File

@ -30,10 +30,6 @@ array[Rounds, Artists] of var 0..10: CardsForArtist;
% Number of Turns played by the closing player this round
array[Rounds] of var 0..10: NominalTurnCount;
% constraint award_bonus_per_round_per_artist[Round1,Krypto] = true;
% constraint award_bonus_per_round_per_artist[Round1,Yoko] = true;
% constraint award_bonus_per_round_per_artist[Round1,ChristinP] = true;
% Symmetry Breaking
constraint Score[Nemo] > Score[Jana];

View File

@ -1,5 +1,5 @@
% How much score was made by each artist in each round by just RANKING
array[Rounds,Artists] of var int: ranking_score_per_artist_per_round;
array[Rounds,Artists] of var 0..3: ranking_score_per_artist_per_round;
% Winning artists for each round (just-by-ranking)
array[Rounds,1..card(Artists)] of var Artists: sorted_artists_per_round;

View File

@ -2,7 +2,7 @@
array[Rounds,Players] of var int: RoundScore;
% Final score of a player
array[Players] of var int: Score;
array[Players] of var 0..500: Score;
% For Cumulative Scoring
% Score = ranking_score + award_score if an award was given this round
@ -12,12 +12,13 @@ constraint forall(r in Rounds, a in Artists) (
if r=Round1 then
0
else
total_score_per_round_per_artist[enum_prev(Rounds, r),a] endif
total_score_per_round_per_artist[enum_prev(Rounds, r),a]
endif
);
% This is same as total_score but force set to zero if the artist is not ranked
% This is what each player gets for each card they play
array[Rounds,Artists] of var int: ArtistScore;
array[Rounds,Artists] of var 0..15: ArtistScore;
constraint forall(r in Rounds, a in Artists) (
ArtistScore[r,a] = if IsArtistRanked[r,a] then total_score_per_round_per_artist[r,a] else 0 endif
);