Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8282207
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T10:17:43+00:00 2026-06-08T10:17:43+00:00

module cafeMap — Hipsters spend their days traveling from one cafe to another. —

  • 0
    module cafeMap
-- Hipsters spend their days traveling from one cafe to another.
-- They use various means of transportation: by car, by bus, and by foot.

sig Cafe {
    walk: set Cafe, -- there is a walking path between cafes
    car: set Cafe, -- there is a street between cafes
    bus: set Cafe -- there is a direct bus route between cafes
}

-- All Cafe pairs with a direct travel link (walk, car or bus)
fun travel[]: Cafe->Cafe {
    car+walk+bus
}

-- All Cafe pairs with direct "green" travel links (walk or bus)
fun greentravel[]: Cafe->Cafe {
    walk+bus
}

-- Does relation r contain every possible pair of Cafes?
pred complete[r: Cafe->Cafe] {
     --your code goes here
}

-- For every pair (c,d) in r, is the reverse pair (d,c) also in r?
pred symmetric[r: Cafe->Cafe] {
     r=~r
}

-- Does r contain no pairs of the form (c,c)?
pred irreflexive[r: Cafe->Cafe] {
    no r & iden -- Is the intersection of r and the identity relation empty?
}

fact {
    irreflexive[walk+car+bus] -- eliminate "self loops"
}

fact {
symmetric[walk]
}

pred show {}

run show for exactly 5 Cafe

Add the following constraints to cafe.als:

  • You can get from any cafe to any other cafe by car (though there may
    not be a direct route).
  • Walking paths between cafes are bidirectional.
  • Every cafe is directly reachable from every other cafe in one or two
    steps.
  • The bus visits every cafe, in a single nonbranching route. (Note: you
    will probably want to slightly change the declaration of the bus
    relation for this.)

I’ve never worked with Alloy and my professer has barely touched on it. I’m really lost, could anyone help explain what’s going on or help me with any of the problems?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T10:17:44+00:00Added an answer on June 8, 2026 at 10:17 am

    I have numbered each of the points in the questions. You can copy the code and paste it anywhere. Don’t forget to change the declaration of the “bus” relation as mentioned in point 4.

    fact Solution{
        -- POINT 1 --
        //You can get from any cafe to any other cafe by car (though there may not be a direct route). 
        all c1, c2: Cafe | c2 in c1.^car
    
    
        -- POINT 2 --
        // Walking paths between cafes are bidirectional.
        symmetric[walk]   
    
    
        -- POINT 3 --
        //  Every cafe is directly reachable from every other cafe in one or two steps.
        //  Either there is a direct route from one cafe (s)  to another (e) or there is a middle cafe (m)
        all disj s, e: Cafe | let route = walk+car+bus | 
            s->e in route or some m:Cafe | (s->m + m->e) in route
    
    
        -- POINT 4 --
        // The bus visits every cafe, in a single nonbranching route. 
        //nonbranching means that every cafe has at most one image over the mapping "bus". Change  "bus: set Cafe" to "bus: lone Cafe"
    
        // The bus route can be circular like this
        all disj c1, c2: Cafe | c2 in c1.^bus
    
        // OR it can be linear like this. It starts with the head from which all other cafes are reachable and no loops exist.
        //one head: Cafe | all c: Cafe - head | c in head.^bus   and not c in c.^bus 
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have one testing module that I want to use for android testing. I
Is there any module which block/truncate the user from login for X(say 5) days.
Module: ./FOO/BAR/Foobar.pm use strict; use warnings; package Foobar; our($VERSION , @ISA , @EXPORT ,
module.pm package module; use 5.012; use warnings; sub Parse { return 1; } 1;
A module I'm adding to our large Java application has to converse with another
I am porting a module of code from Solaris to Linux. I get this
A module that uses the spawn function from child-process module to call a program
My module is all in one big file that is getting hard to maintain.
Is there any python module to convert PDF files into text? I tried one
Module in macruby has many methods that it doesn't usually have. One of these

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.