to be least diff
- (be1 or not to2 be2 ) - (to1 that is the question ) = 5556
- (be1 or not to2 be2 ) - (to1 that is question the ) = 5547
- (be1 or not to2 be2 ) - (to1 that the is question ) = 5466
- (be1 or not to2 be2 ) - (to1 that the question is ) = 5448
- (be1 or not to2 be2 ) - (to1 that question is the ) = 5367
- (be1 or not to2 be2 ) - (to1 that question the is ) = 5358
- (be1 or not to2 be2 ) - (to1 is that the question ) = 4656
- (be1 or not to2 be2 ) - (to1 is that question the ) = 4647
- (be1 or not to2 be2 ) - (to1 is the that question ) = 4476
- (be1 or not to2 be2 ) - (to1 is question that the ) = 4377
- (be1 or not to2 be2 ) - (to1 is question the that ) = 4359
- (be1 or not to2 be2 ) - (to1 the that is question ) = 3666
- (be1 or not to2 be2 ) - (to1 the that question is ) = 3648
- (be1 or not to2 be2 ) - (to1 the is that question ) = 3576
- (be1 or not to2 be2 ) - (to1 the is question that ) = 3549
- (be1 or not to2 be2 ) - (to1 the question that is ) = 3378
- (be1 or not to2 be2 ) - (to1 the question is that ) = 3369
- (be1 or not to2 be2 ) - (to1 question that is the ) = 2667
- (be1 or not to2 be2 ) - (to1 question that the is ) = 2658
- (be1 or not to2 be2 ) - (to1 question is that the ) = 2577
- (be1 or not to2 be2 ) - (to1 question is the that ) = 2559
- (be1 or not to2 be2 ) - (to1 question the that is ) = 2478
- (be1 or not to2 be2 ) - (to1 question the is that ) = 2469
- (or to1 not to2 be2 ) - (be1 is question that the ) = 2377
- (or to1 not to2 be2 ) - (be1 is question the that ) = 2359
- (or to1 not to2 be2 ) - (be1 the that is question ) = 1666
- (or to1 not to2 be2 ) - (be1 the that question is ) = 1648
- (or to1 not to2 be2 ) - (be1 the is that question ) = 1576
- (or to1 not to2 be2 ) - (be1 the is question that ) = 1549
- (or to1 not to2 be2 ) - (be1 the question that is ) = 1378
- (or to1 not to2 be2 ) - (be1 the question is that ) = 1369
- (or to1 not to2 be2 ) - (be1 question that is the ) = 667
- (or to1 not to2 be2 ) - (be1 question that the is ) = 658
- (or to1 not to2 be2 ) - (be1 question is that the ) = 577
- (or to1 not to2 be2 ) - (be1 question is the that ) = 559
- (or to1 not to2 be2 ) - (be1 question the that is ) = 478
- (or to1 not to2 be2 ) - (be1 question the is that ) = 469
- (not to1 be1 to2 be2 ) - (or question that is the ) = 467
- (not to1 be1 to2 be2 ) - (or question that the is ) = 458
- (not to1 be1 to2 be2 ) - (or question is that the ) = 377
- (not to1 be1 to2 be2 ) - (or question is the that ) = 359
- (not to1 be1 to2 be2 ) - (or question the that is ) = 278
- (not to1 be1 to2 be2 ) - (or question the is that ) = 269
- (to2 to1 be1 or be2 ) - (not question the that is ) = 258
- (to2 to1 be1 or be2 ) - (not question the is that ) = 249
- (be2 to1 be1 or not ) - (to2 question the is that ) = 247
MiniZinc model
include "globals.mzn";
int: n = 10;
int: m = n div 2;
array[1..m] of int: bases = [ceil(pow(10.0,int2float(m-i))) | i in 1..m];
set of int: digits = 0..9;
var digits: A;
var digits: B;
var digits: C;
var digits: D;
var digits: E;
var digits: F;
var digits: G;
var digits: H;
var digits: I;
var digits: J;
array[0..n-1] of string: s = array1d(0..n-1,
["to1 ",
"be1 ",
"or ",
"not ",
"to2 ",
"be2 ",
"that ",
"is ",
"the ",
"question"]);
array[1..n] of var digits: FD = [A, B, C, D, E, F, G, H, I, J];
var int: X;
var int: Y;
var int: difference = X - Y;
predicate scalar_product(array[int] of var int: arr1, array[int] of var int: arr2, var int: result) =
assert(card(index_set(arr1)) == card(index_set(arr2)),
"scalar_product: arr1 and arr2 must be of same length.",
result = sum(i in index_set(arr1)) (
arr1[i] * arr2[i]
)
)
;
constraint
scalar_product(bases, [A,B,C,D,E], X) /\
scalar_product(bases, [F,G,H,I,J], Y) /\
all_different(FD) /\
difference > 0
;
solve minimize difference;
output
["<li> ("] ++
[
show(s[fix(FD[i])]) ++ " "
| i in 1..5
]
++ [") - ("] ++
[
show(s[fix(FD[i])]) ++ " "
| i in 6..10
]
++ [") = "] ++
[
show(difference)
];
Back to Constrained-based constraint poetry
Created by Hakan Kjellerstrand hakank@gmail.com