1.we haben Radfahren Tabelle 2. ein Mann muss neben einer Frau und einer Frau neben einem Mann sitzen 3. Gäste müssen teile Hobbys (mindestens eine gemeinsame zwischen ihren Hobbys) 4. Es gibt Paare von wütenden Gästen. sie dürfen nicht in der Nähe nebeneinander 5. niemand Liste o wütend Gäste sitzen muss beim Start (Sitz 1) oder Ende (Sitz N) sitzen -PR ist die Anzahl der Paare wütendminizinc sitzen-Freunde-am-Tisch-weit-von-Furius diejenigen
mein Modell:
int :N;
set of int: GUESTS = 1..N;
set of int: POSITIONS = 1..N;
array[GUESTS] of 1..2 : gender;
array[GUESTS] of set of int: hobbies;
enum PAIR = {first,second};
int : pR;
set of int: LIST = 1..pR;
array[LIST,PAIR] of GUESTS : furious;
array[POSITIONS] of var GUESTS : guest_at;
array[POSITIONS] of var 1..2: table_gender;
constraint forall(i in 1..length(table_gender)-1)(
table_gender[i]!=table_gender[i+1]
/\
table_gender[1]!=table_gender[length(table_gender)]
)
;
include "alldifferent.mzn";
constraint alldifferent(guest_at);
constraint forall(i in 2..N-1)(card(hobbies[guest_at[i+1]] intersect hobbies[guest_at[i]]) >0);
constraint card(hobbies[guest_at[N]] intersect hobbies[guest_at[1]]) >0;
constraint forall(i in 2..N-1,l in LIST, p in PAIR)(if guest_at[i]=furious[i,first] then guest_at[i+1]!=furious[i,second] /\ guest_at[i-1]!=furious[i,second] else true endif);
constraint forall(l in LIST, p in PAIR)(guest_at[1]!=furious[l,p] /\ guest_at[N]!=furious[l,p]);
solve satisfy;
output
["guest_at = \(guest_at);"]
++ ["\ntable_gender = \(table_gender); \n" ]
++ ["Furious Placement\n"]
++ [show_int(4,furious[i,j]) | i in LIST, j in PAIR] ++["\n"]
++ [if fix(guest_at[p]) = furious[i,j] then show_int(4,p) else "" endif | i in LIST, j in PAIR, p in POSITIONS]
;
Bugs mein Modell:
C:/Users/�������/Documents/������/����������/Gala/gala.mzn:36:
in call 'forall'
in array comprehension expression
with i = 4
with l = 3
with p = 1
in if-then-else expression
in binary '=' operator expression
in array access
WARNING: Further warnings have been suppressed.
Dies ist keine Frage. Bitte bearbeiten Sie es, also ist es eine gültige Frage. – TPAKTOPA
Bitte fügen Sie auch das komplette Modell hinzu. – hakank
Ich habe es gerade bearbeitet, um eine gültige Frage zu sein ... Wie kann ich Bugs entfernen? Wie kann ich es bearbeiten? – Kotsos