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 8769035
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T17:13:40+00:00 2026-06-13T17:13:40+00:00

I’m quite new to alloy and currently reading the tutorials at mit. I got

  • 0

I’m quite new to alloy and currently reading the tutorials at mit. I got a little stuck in the logic of things. A very basic thing i’m trying to do is below.

  • a person can only do at most 1 task
  • a task can be done at most by 1 person
  • a person can only do what s/he is able to

When i run the following, everyone has the same skills(all skills) and every task requires the same skills (all again). The people at least get assigned 1 task each but they get the same task sometimes.

thanks in advance

some sig Skills{ }


some sig Person  {
 has:  some Skills, 
 assigned: lone Task
 }

some sig Task
 {  
 requires: some Skills
 }
 {
// everyone must have the required task skills for assignment
 all p:Person | p.has= requires
 }

pred Valid ()
 {  
//everyone must be assigned to single task
  all p:Person | lone t:Task| p.assigned in t
// no one can have the same task
  no p1:Person , p2:Person | p1.assigned not in p2.assigned
 }

run Valid
  • 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-13T17:13:42+00:00Added an answer on June 13, 2026 at 5:13 pm

    There are a number of things that are incorrect in your model.

    • a person can only do at most 1 task

    To implement this, the lone multiplicity modifier for the assigned field in the Person signature is sufficient. If you want every person to have exactly one task assigned, you can change lone to one.

    • a task can be done at most by 1 person

    Your constraint in the Valid predicate is wrong because instead of p1.assigned not in p2.assigned you should write p1.assigned = p2.assigned in order to say that there are no two persons that have the same task assigned. Additionally you should add a constraint that ensures that p1 != p2. Alternatively, you could write all p1, p2: Person | p1 != p2 implies p1.assigned != p2.assigned. Finally, to avoid having to write p1 != p2 in the quantifier body, you can use the disj keyword to say, e.g., no disj p1, p2: Person | p1.assigned = p2.assigned, or all disj p1, p2: Person | p1.assigned != p2.assigned.

    • a person can only do what s/he is able to

    Your constraint in the appended facts section of the Task signature is wrong because it doesn’t mention the assigned field at all, which is what you must do in order to say that
    for each person and the task assigned to them, the person has all the skills required by the task. What you wrote means that for every task, every person has all the skills required by that task. The only way to satisfy that, is if all tasks have the same set of skills, which is exactly what you noticed in all instances you were getting for your model.

    Here is how I would model this (note the slight changes in field and signature names, which makes the model slightly more readable and understandable):

    some sig Skill {}
    
    some sig Person  {
        hasSkill:  some Skill, 
        assignedTask: lone Task
    }
    
    some sig Task {  
        requiredSkills: some Skill
    }
    
    // everyone must have the required skills for the assigned task
    fact requiredTaskSkills {
        all p:Person | p.hasSkill in p.assignedTask.requiredSkills
    }
    
    // everyone has at least one assigned task
    pred atLeastOneTask {
        all p: Person | one p.assignedTask
    }
    
    // no two persons can have the same task assigned 
    pred uniqueTaskAssignments {
        no disj p1, p2: Person | p1.assignedTask = p2.assignedTask
    }    
    
    run { 
        atLeastOneTask and uniqueTaskAssignments
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want use html5's new tag to play a wav file (currently only supported
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I am reading a book about Javascript and jQuery and using one of the
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I am currently running into a problem where an element is coming back from
i got an object with contents of html markup in it, for example: string
I'm parsing an XML file, the creators of it stuck in a bunch social
Let's say I'm outputting a post title and in our database, it's Hello Y’all

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.