How to specify the specific elements in order - using util ordering in Alloy? -
my intention here specify date in order. start d, followed d1, d2, d3, , end d". have initialised 'd = request.begin' first element while 'd"' last element in ordering. in following codes, define 'd1 = d.next', 'd2 = d1.next', and, 'd3 = d2.next'. in addition, invoked util ordering in library; 'open util/ordering [date] dateorder'. however, no instance found when executing codes. please let me know what's problem codes?
open util/ordering [date] dateorder abstract sig resource {} 1 sig tour extends resource {date : 1 date, destination : tour_destination} 1 sig tour_destination {} pred holiday [disjoint d,d1,d2,d3,d": date , r:request, t:tour] { r.begin = d , r.end = d" t.date = d or t.date = d1 or t.date = d2 or t.date = d3 or t.date = d" d != d"} sig date{} pred init [d:date]{d= request.begin} fact traces { init [first] let d" = last | 1 d : date - last | let d1 = d.next, d2 = d1.next, d3 = d2.next | lone t: tour, r: request| holiday [d,d1,d2,d3,d",r,t]} 1 sig request{tour_request: 1 tour,begin: 1 date, end: 1 date} run holiday
there isn't problem. given code might fine, model represents might inconsistent (thus alloy cannot find instance). note since did not presented full model, neither enough details of predicate running, answer tries guess might wrong.
it seems statement
one d: date - last
causes inconsistency you. note that, due import of ordering, such statement might consistent universes have 2 instances of date signature.
as example, if one
replaced some
, alloy finds lot of instances following model:
open util/ordering [date] sig request{ begin: lone date } sig date{} pred init [d:date]{d= request.begin} fact traces { init [first] let d" = last | d : date - last | let d1 = d.next, d2 = d1.next, d3 = d2.next | d1 in date && d2 in date && d3 in date && d" in date } run {} 4 1 request
Comments
Post a Comment