我在 ALLOY 中有一段代码我正在尝试做一个餐厅预订系统,我有这个信号和它们之间的关系。
abstract sig Table{
breakfast: one breakFast,
lunch: one Lunch,
dinner: one Dinner
}
sig Free{
}
sig Reserved{
}
sig breakFast {
breakfastfree:one Free,
breakfastReserved:one Reserved
}
sig Lunch {
Lunchfree:one Free,
LunchReserved:one Reserved
}
sig Dinner {
Dinnerfree:one Free,
DinnertReserved:one Reserved
}
fact{
all t1,t2 : Table | t1 != t2 => t1.breakfast != t2.breakfast
all t1,t2 : Table | t1 != t2 => t1.lunch != t2.lunch
all t1,t2 : Table | t1 != t2 => t1.dinner != t2.dinner
}
pred RealismConstraints []{
#Table = 4
}
run RealismConstraints for 20
我想说明一个事实,早餐可以预订或免费,午餐和晚餐都一样,有什么想法吗?