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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T15:24:26+00:00 2026-05-12T15:24:26+00:00

I have the following simple problem that I’d like to use to experiment with

  • 0

I have the following simple problem that I’d like to use to experiment with MS Solver Foundation:

I have a schedule where I need to have 2 workers per day for 30 days. I need to honor the following constraints:

  • No people should work two days in a row.
  • Unless a special exception is applied, people should only work once per week.
  • Some people can only work weekends.
  • Some people can only work weekdays.

I plan to use C# to populate the model, but I need help getting started with the modeling. I’m not sure how to setup the decisions, parameters and constraints to address this type of problem.

Update: While ire-and-curses has a good start, I have to imagine that there’s a more declarative way to express those constraints using the framework rather than have to code them individually for every person. Anyone more familiar with MSF that can help with this construction?

  • 1 1 Answer
  • 2 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-05-12T15:24:26+00:00Added an answer on May 12, 2026 at 3:24 pm

    If you have n people, you will have to define 30n binary integer parameters each indicating if a person works on a specific day or not.

    P<xx>D<yy> == 1 => Person <xx> works on day <yy>
    P<xx>D<yy> == 0 => Person <xx> does not work on day <yy>
    

    Then you need constraints to prevent working on two days in row. This will be 29n constraints.

    P<xx>D<yy> + P<xx>D<yy+1> <= 1
    

    Then you need constraints to work only once per week. This will be the following for the first week and similar for the next three weeks.

    P<xx>D00 + P<xx>D01 + P<xx>D02 + P<xx>D03 + P<xx>D04 + P<xx>D05 + P<xx>D06 <= 1
    

    The last week will just be the following.

    P<xx>D28 + P<xx>D29 <= 1
    

    This will yield another 5n constraints. Then add constraints for weekdays only

    P<xx>D05 + P<xx>D06 == 0
    P<xx>D12 + P<xx>D13 == 0
    P<xx>D19 + P<xx>D20 == 0
    P<xx>D26 + P<xx>D27 == 0
    

    and weekends only

    P<xx>D00 + P<xx>D01 + P<xx>D02 + P<xx>D03 + P<xx>D04 == 0
    P<xx>D07 + P<xx>D08 + P<xx>D09 + P<xx>D10 + P<xx>D11 == 0
    P<xx>D14 + P<xx>D15 + P<xx>D16 + P<xx>D17 + P<xx>D18 == 0
    P<xx>D21 + P<xx>D22 + P<xx>D23 + P<xx>D24 + P<xx>D25 == 0
    P<xx>D28 + P<xx>D29 == 0
    

    and finally add a target function.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a simple problem with that fetch_array. i like to read out x1
this seems like a simple problem. I have a canvas application that I am
it is the problem, i can't undertand anyway. i have the following simple script
I have the following simple python test script that uses Suds to call a
I know only very little about C++/CLI, but I have a simple problem that
I have the following simple XML structure that has to be parsed: <Nodes> <Node
A simple problem that I just can't find the 'right' answer too. I have
maybe that problem is simple, but I have no Idea how to solve this,
I have the following simple button with an image as the template. The problem
I have a simple vim problem that Google hasn't managed to help me with.

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.