[2021][ruby][8.2] clean up minizinc solver

pull/2/head
Alpha Chen 3 years ago
parent 038495b353
commit 1a3d489be8

@ -14,7 +14,7 @@ set of Signals: Eight = { A, B, C, D, E, F, G };
set of Signals: Nine = { A, B, C, D, F, G }; set of Signals: Nine = { A, B, C, D, F, G };
array[1..10] of set of Signals: AllSignals = [ Zero, One, Two, Three, Four, Five, Six, Seven, Eight, Nine ]; array[1..10] of set of Signals: AllSignals = [ Zero, One, Two, Three, Four, Five, Six, Seven, Eight, Nine ];
array[int] of set of Signals: Patterns; array[1..10] of set of Signals: Patterns;
% Patterns = [ % Patterns = [
% { A, C, E, D, G, F, B }, % { A, C, E, D, G, F, B },
% { C, D, F, B, E }, % { C, D, F, B, E },
@ -31,10 +31,8 @@ array[int] of set of Signals: Patterns;
array [Signals] of var Signals: Map; array [Signals] of var Signals: Map;
constraint alldifferent(Map); constraint alldifferent(Map);
constraint forall(pattern in Patterns)( constraint forall(pattern in [ { Map[x] | x in pattern } | pattern in Patterns])(
exists(digit in AllSignals)( exists(digit in AllSignals)(pattern = digit)
{ Map[x] | x in pattern } = digit
)
); );
output [show(Map)]; output [show(Map)];
Loading…
Cancel
Save