Analyzing Different Approaches for Key Constraint in Hotel Room Allocation

each hotel guest has a set of keys n.w
1 / 10
Embed
Share

Explore the equivalence between two approaches for constraining keys in hotel room allocation, ensuring each guest has a unique set of keys. Learn how to compare them using Alloy Analyzer to search for potential counterexamples.

  • Hotel
  • Room Allocation
  • Key Constraint
  • Equivalent Approaches
  • Alloy Analyzer

Uploaded on | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. Each hotel guest has a set of keys and no two guests have the same key Roger L. Costello April 3, 2018

  2. We want each room to have its own unique set of keys Keys for Room1 K3 K4 K5 K0 K1 K2 K6 Keys for Room0 Keys for Room2 K7 K8

  3. keys Room0 K0 This declaration: Room0 K1 Room0 K2 sig Room {keys: set Key} Same key used in three rooms ouch! Room1 K0 Room1 K4 allows undesirable instances such as the one shown on the right. Notice that K0 is used by rooms 0, 1, and 2. Room1 K5 Room2 K0 Room2 K7 Room2 K8

  4. sig Room {keys: set Key} We need to specify a constraint on the set of Key values.

  5. Heres one approach to constraining keys pred DisjointKeySet { keys in Room lone -> Key } constrain sig Room {keys: set Key} Each Key value is associated to at most one Room.

  6. Heres another approach sig Room {keys: disjset Key} Each room has a set of key and each set is disjoint.

  7. Are the two approaches equivalent? I believe they are. To be certain, however, let s get the Alloy Analyzer to compare the two approaches and search for counterexamples. How to do this? How to write the proper assert?

  8. The book Software Abstractions says (p. 274) equivalent sig S {f: disj e} sig S {f: e} pred Every_S_has_a_different_value_for_f { all a,b: S | a != b => no a.f & b.f }

  9. Therefore, equivalent sig S {f: disj e} sig S {f: e} pred Every_S_has_a_different_value_for_f { all a,b: S | a != b => no a.f & b.f } equivalent sig Room {keys: disjset Key} sig Room {keys: set Key} pred Every_Room_has_a_different_set_of_keys{ all r, r': Room | r != r' => no r.keys & r'.keys }

  10. sig Key {} sig Room { keys: set Key } pred DisjointKeySet_v1 { keys in Room lone -> Key } pred DisjointKeySet_v2 { all r, r': Room | r != r' => no r.keys & r'.keys } assert Equivalent { DisjointKeySet_v1 iff DisjointKeySet_v2 } check Equivalent

More Related Content