我必须在大学项目的需求分析和规范文档中使用合金。我从简单的东西开始,只有签名和事实。这是我使用的签名:合金分析仪4.2中未显示合金签名
abstract sig Date{
year: one Int,
month: one Int,
day: one Int
}
abstract sig Time{
h: one Int,
m: one Int,
s: one Int
}
abstract sig Double{
leftPart: one Int,
rightPart: one Int
}
abstract sig Bool{
value: one String
}
sig DateBirth extends Date{}
sig DateRide extends Date{}
sig DateExpiry extends Date{}
abstract sig User {
email: one String,
name: one String,
surname: one String,
gender: one Bool,
address: one String,
password: one String,
dateOfBirth: one DateBirth,
IDRide: set Ride
}
sig TaxiDriver extends User{
taxiLicense: one String,
personalLicense: one String,
IBAN: one String,
positionInQueue: lone Int,
IDTaxi: set Taxi
}
sig Client extends User{
}
sig Zone {
numberOfZone: one Int,
vertexNorthWest: one Double,
vertexNorthEast: one Double,
vertexSouthWest: one Double,
vertexSouthEast: one Double,
currentQueue: set TaxiDriver
}
sig Taxi {
IDTaxi: one String,
plate: one String,
availablePlaces: one Int,
}
sig Ride {
IDRide: one String,
origin: one String,
destination: one String,
dateOfRide: one DateRide,
timeOfDeparture: one Time,
timeOfArrival: one Time,
price: one Double,
numberOfPeople: one Int,
accepted: one Bool,
userEmail: set User
}
sig Credit_Card {
number: Double,
owner: String,
expiryDate: DateExpiry,
ownerEmail: one Client
}
然后,我添加了谓词“秀”给veify的是否一致与否:
pred Show{}
run Show for 10
上运行合金分析仪4.2这个“执行”之后是我得到的消息:
Executing "Run Show for 10"
Solver=sat4j Bitwidth=4 MaxSeq=7 SkolemDepth=1 Symmetry=20
21067 vars. 3840 primary vars. 37164 clauses. 376ms.
Instance. found. Predicate is consistent. 375ms.
没问题吧?但是,当我点击“显示”时,显示器上没有显示签名“用户”(及其子签名)的实例,而所有其他人都在那里。我试图点击“下一个”数十亿次,试图看看我是否可以找到他们展示的模型,但没有。 任何想法/建议?谢谢!
实际上,字符串被实现。你只需要为那些组成生成的实例的字符串原子或字符串指定一个“池”。你可以在Q/A中找到更多关于字符串用法的地址:http://stackoverflow.com/questions/27397887/provide-alloy-with-a-pool-of-custom-strings –