diff --git a/academic/FoxGeeseCorn/FoxGeeseCorn.py b/academic/FoxGeeseCorn/FoxGeeseCorn.py index 6e729d9..90b6437 100644 --- a/academic/FoxGeeseCorn/FoxGeeseCorn.py +++ b/academic/FoxGeeseCorn/FoxGeeseCorn.py @@ -35,10 +35,13 @@ from pycsp3 import * -# data from Minizinc challenge 2019 -mzn19 = [(6, 7, 8, 4, 15, 8, 12, 9), (50, 50, 50, 7, 35, 9, 10, 8), (6, 7, 8, 1, 31, 0, 6, 3), (118, 213, 124, 178, 3, 7, 5, 3), (10, 10, 12, 5, 19, 1, 1, 1)] +# data from Minizinc challenge 2019 (indexes from 0 to 4) and 2024 (indexes from 5 to 0) +mzn = ( + [(6, 7, 8, 4, 15, 8, 12, 9), (50, 50, 50, 7, 35, 9, 10, 8), (6, 7, 8, 1, 31, 0, 6, 3), (118, 213, 124, 178, 3, 7, 5, 3), (10, 10, 12, 5, 19, 1, 1, 1)] + + [(6, 26, 8, 2, 25, 4, 4, 3), (20, 20, 22, 6, 15, 6, 5, 4), (36, 37, 40, 3, 35, 9, 9, 9), (36, 37, 40, 6, 35, 9, 10, 8), (35, 27, 52, 6, 22, 1, 0, 0)] +) -nFoxes, nGeese, nCorns, boatCapacity, horizon, pf, pg, pc = mzn19[data] if isinstance(data, int) else data +nFoxes, nGeese, nCorns, boatCapacity, horizon, pf, pg, pc = mzn[data] if isinstance(data, int) else data EAST = [i for i in range(1, horizon + 1) if i % 2 == 1] WEST = [i for i in range(1, horizon + 1) if i % 2 != 1] @@ -155,7 +158,7 @@ def alone(i): ef[z] * pf + eg[z] * pg + ec[z] * pc ) -""" +""" Comments 1) It is possible to avoid declaring the array aux, and declare a variable when calling 'alone(i)' as follows: tmp = Var(dom=range(4), id="tmp" + str(i)) """ diff --git a/academic/PeacableQueens/PeacableQueens.py b/academic/PeacableQueens/PeacableQueens.py index bfe97e5..e802427 100644 --- a/academic/PeacableQueens/PeacableQueens.py +++ b/academic/PeacableQueens/PeacableQueens.py @@ -84,7 +84,9 @@ def automaton(): """ Comments 1) Note that (q2, [0,2], q2) is a shortcut for {(q2, 0, q2), (q2, 2, q2)} It is also possible to save the automatas in this compact form with the option -keepSmartTransitions -2) Data used in 2021 are: 8, 11, 25, 40, 50 +2) Data used + in 2021 are: 8, 11, 25, 40, 50 + in 2024 are: 7, 9, 12, 19, 35 3) Note that x[symmetry]) is equivalent o: diff --git a/academic/Triangular/Triangular.py b/academic/Triangular/Triangular.py index b0afcb9..8905d44 100644 --- a/academic/Triangular/Triangular.py +++ b/academic/Triangular/Triangular.py @@ -27,7 +27,7 @@ n = data -# x[i,j] is 1 iff the jth node in the ith row is selected +# x[i][j] is 1 iff the jth node in the ith row is selected x = VarArray(size=[n, n], dom=lambda i, j: {0, 1} if i >= j else None) satisfy( @@ -45,8 +45,15 @@ ) """ Comments -1) Data used in challenges are: +1) Data used in Minizinc challenges are: 10, 16, 22, 28, 37 in 2015 10, 17, 23, 29, 37 in 2019 10, 18, 24, 30, 39 in 2022 + 09, 11, 14, 20, 31 in 2024 +2) + AtLeastOne( + within=[x[i + m][j], x[i + k][j + m], x[i + k - m][j + k - m]], + value=0 + ) for i in range(n) for j in range(i + 1) for k in range(1, n - i) for m in range(k) + seems to be less efficient """