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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:17:05+00:00 2026-05-25T00:17:05+00:00

I am designing a project management app for a factory. The app is expected

  • 0

I am designing a project management app for a factory. The app is expected to produce draft project plans. To schedule a task, the app should check three conditions:

  1. task dependency – do not start before,
  2. machine availability, and
  3. shift work hours

I keep track of machine engagement in machine_allocations table:

machine_allocations
+------------+--------------+-----------------+---------------+
| machine_id | operation_id | start_timestamp | end_timestamp |
+------------+--------------+-----------------+---------------+

Shift hours follow a pattern.

Now, to find the earliest possible date-time for an operation I am thinking of a function:

function earliest_slot($machine_id, $for_duration, $no_sooner_than) {
   // pseudo code
   1. get records for the machine in question for after $no_sooner_than 
   2. put start and end timestamps into $unavailable array
   3. add non-working times as new elements to the array
   4. in a loop find timeslots which are not in the array
   5. if a timeslot is found which is equal to or bigger than $for_duration, return that
}

My question is, is this a good approach? Are there simpler ways to do this?

  • 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-05-25T00:17:06+00:00Added an answer on May 25, 2026 at 12:17 am

    Finding the earliest date-time for one operation at a time may not give you the best result. Consider the example where operation A uses machine 1 for a long time, operation B uses machine 1 for a short time and operation C uses machine 2 for a short time, but operation C must be done after B.

    In this case, it is better to schedule B before A on machine 1, but your approach would not achieve this. Of course, writing and using software to manage this would be more difficult than what you have suggested, so you need to decide whether the benefit is worth the extra effort.

    Have a look at Scheduling, Job Shop Scheduling and Scheduling algorithm.

    First you need to think about what sort of information you can collect about tasks (such as dependencies, priorities, deadlines) and then decide how best to put it together.

    You may find that an approach like you propose is good enough in your case. My addition to your proposed algorithm would be to sort the list of existing machine operations to make searching through them faster, that is you can stop as soon as you find a time where your operation fits because it’s guaranteed to be the earliest time.

    A relatively simple extension would be a priority system that allows you to bump lower-priority tasks forward (which may require the adjustment of their dependencies as well), but more complicated algorithms would consider multiple tasks at once and try to optimise the outcome. In the end it comes down to what’s appropriate for your specific problem.

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

Sidebar

Related Questions

i am currently designing a ebook reader app as my project, i am having
I'm designing a CMS for a private project that should make the editing of
I'm designing a project for quizzes and quizz results. So I have two tables:
i am designing a simple project based to do list. the idea is to
I got a project of designing a Database. This is going to be my
I'm currently designing a database for a project. Now I'm debating with myself whether
I am designing a database for a project. I have a table that has
I am currently designing a Membership/Profile scheme for a new project I am working
I am currently designing a forum as a personal project. One of the recurring
As a part of my final year university project I am designing a social

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.