Fathiyeh
Fathiyeh

Reputation: 33

Memory Issue in Alloy

I am new to Alloy. I am trying to find a solution for a model with 512 states. But it runs out of memory. I set the memory and stack to its maximum level, but it is not enough. Is there any other way I could use to increase the memory Alloy uses? I appreciate your time and help. Thanks a lot, Fathiyeh

Upvotes: 2

Views: 123

Answers (2)

Daniel Jackson
Daniel Jackson

Reputation: 2768

Hard to know where to start. Looks as if you're writing an Alloy model as if you're expecting it to be a model checker. But the point of Alloy is to allow you to analyze systems whose states have complex structure, with constraints written in a relational logic. You won't get very far doing a direct encoding of a low-level model into Alloy; for that kind of thing you'd do better to use a model checker.

Upvotes: 1

Fathiyeh
Fathiyeh

Reputation: 33

module threeprocesses
abstract sig boolean {
 }
one sig true,false extends boolean{}


sig state {
    e1: boolean,
    t1: boolean,
    ready1: boolean,
    e2: boolean,
    t2: boolean,
    ready2: boolean,
    e3: boolean,
    t3: boolean,
    ready3: boolean
   }


sig relation {
    lambda : state -> one Int,
    next1 : state -> state
   }

pred LS (s : state) {
    (((s.t1 =s.t3) and (s.t2 =s.t1) and (s.t3 =s.t2)) 
    or ((s.t1 != s.t3) and (s.t2 !=s.t1) and (s.t3 =s.t2)) 
    or ((s.t1 != s.t3) and (s.t2 =s.t1) and (s.t3 !=s.t2))) and
    ((s.e1 =s.e3) or (s.e2 !=s.e1) or (s.e3 !=s.e2)) 
}



pred show (r:relation) {
  all s : state |
  LS [s] implies LS [s.(r.next1)]


  all s : state |
    (not (LS [s])) implies not (s =s.(r.next1)) 
  all s : state |
    (not (LS [s])) implies  (all s2 :  (s.(r.next1)) | s2. (r.lambda) > s.(r.lambda))

  all s : state,s2 : state |
    ((s.t1 = s2.t1) and (s.e1 = s2.e1) and (s.ready1 = s2.ready1) and (s.e3 = s2.e3)   
    and (s.t3 = s2.t3)) implies
    ( (((s2.(r.next1)).ready1)= ((s.(r.next1)).ready1)) and (((s2.(r.next1)).e1)= ((s.    
    (r.next1)).e1)) and
    (((s2.(r.next1)).t1)= ((s.(r.next1)).t1)) )

  all s : state,s2 : state |
    ((s.t2 = s2.t2) and (s.e2 = s2.e2) and (s.ready2 = s2.ready2) and (s.e1 = s2.e1) 
    and (s.t1 = s2.t1)) implies
    ( (((s2.(r.next1)).ready2)= ((s.(r.next1)).ready2)) and (((s2.(r.next1)).e2)= ((s. 
    (r.next1)).e2)) and
    (((s2.(r.next1)).t2)= ((s.(r.next1)).t2)) )

all s : state,s2 : state |
    ((s.t3 = s2.t3) and (s.e3 = s2.e3) and (s.ready3 = s2.ready3) and (s.e2 = s2.e2) 
    and (s.t2 = s2.t2)) implies
    ( (((s2.(r.next1)).ready3)= ((s.(r.next1)).ready3)) and (((s2.(r.next1)).e3)= ((s.
    (r.next1)).e3)) and
    (((s2.(r.next1)).t3)= ((s.(r.next1)).t3)) )

all s : state |
   (not ( (s.e1 =  ((s.(r.next1)).e1))  and (s.t1 =  ((s.(r.next1)).t1)) and (s.ready1 
   =  ((s.(r.next1)).ready1)) ) ) implies
  (s.e1 = s.e3)

all s : state |
   (not ( (s.e2 =  ((s.(r.next1)).e2))  and (s.t2 =  ((s.(r.next1)).t2)) and (s.ready2 
   =  ((s.(r.next1)).ready2)) ) ) implies
   (not (s.e2 = s.e1))

all s : state |
   (not ( (s.e3 =  ((s.(r.next1)).e3))  and (s.t3 =  ((s.(r.next1)).t3)) and (s.ready3 
   =  ((s.(r.next1)).ready3)) ) ) implies
   (not (s.e3 = s.e2))

all s : state ,s2:state |
   (s != s2) implies (not ((s.e1 = s2.e1) and (s.e2 = s2.e2) and (s.e3 = s2.e3) and 
   (s.t1 = s2.t1) and (s.t2 = s2.t2) and (s.t3 = s2.t3) and
   (s.ready1 = s2.ready1) and (s.ready2 = s2.ready2) and (s.ready3 = s2.ready3)))

}


run show for 3 but 1 relation, exactly 512 state 

Upvotes: 0

Related Questions