Commit cf9ec630 authored by Amin Raslan's avatar Amin Raslan
Browse files

Upload New File

parent 66172c64
numbers[1] numbers[2] numbers[3]
numbers[4] numbers[5] numbers[6] numbers[7]
numbers[8] numbers[9] numbers[10] numbers[11] numbers[12]
numbers[13] numbers[14] numbers[15] numbers[16]
numbers[17] numbers[18] numbers[19]
include "alldifferent.mzn";
int: sum = 38;
array[1..19] of var 1..19: numbers;
constraint all_different(numbers);
constraint sum(numbers[1..3]) = sum;
constraint sum(numbers[4..7]) = sum;
constraint sum(numbers[8..12]) = sum;
constraint sum(numbers[13..16]) = sum;
constraint sum(numbers[17..19]) = sum;
%Schräg nach oben rechts
constraint sum([numbers[1], numbers[4], numbers[8]]) = sum;
constraint sum([numbers[2], numbers[5], numbers[9], numbers[13]]) = sum;
constraint sum([numbers[3], numbers[6], numbers[10], numbers[14], numbers[17]]) = sum;
constraint sum([numbers[7], numbers[11], numbers[15], numbers[18]]) = sum;
constraint sum([numbers[12], numbers[16], numbers[19]]) = sum;
%Schräg nach oben links
constraint sum([numbers[3], numbers[7], numbers[12]]) = sum;
constraint sum([numbers[2], numbers[6], numbers[11], numbers[16]]) = sum;
constraint sum([numbers[1], numbers[5], numbers[10], numbers[15], numbers[19]]) = sum;
constraint sum([numbers[4], numbers[9], numbers[14], numbers[18]]) = sum;
constraint sum([numbers[8], numbers[13], numbers[17]]) = sum;
solve satisfy;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment