Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# Scheduler Algorithms
I have a series of processes that I want to occur in the least amount of time.
Each Series has 4 consecutive parts, each component part may have different times in each series. The waits may be longer or shorter than the processes, The second waits must occur consecutively.
ProccessA
Wait1
ProcessB
Wait2
The processes cannot overlap, but the processes can occur while another series is waiting.
e.g.
|________|--A--|--W1-----------|--B--|--W2--|
|_______________|--A--|--W1-----------|--B--|--W2--|
||--A--|--W1----------------------------------------------------------------|--B--|--W2--|
I have defined the following arrays
StartTimeA[n] - The start times for each series
StartTimeB[n] - The start times for the ProcessB in each series
ATime[n] - The lengths of time for ProcessA
BTime[n] - The lengths of time for ProcessB
Wait1[n] - The initial waiting times for the series
Wait2[n] - The final waiting times for the series
 
I have tried a number of approaches, but am always getting some processes overlapping.
I would dearly appreciate a suggested algorithm. I will be implementing in c#.
Posted 18-Feb-13 9:08am
Edited 18-Feb-13 12:03pm
v4
Comments
Sergey Alexandrovich Kryukov at 18-Feb-13 14:19pm
   
Isn't it obvious that it's not always possible to plan processes without overlaps or gaps? Optimization is not eliminating them.
—SA

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

If you want the best solution, you need to evaluate all permutations.
Often, a good enough solution is sufficient.
 
If you can define a "good enough" criterion, you can define a break condition to stop searching.
E.g. (pseudo code):
iteration = MaxIterations;
best = none;
while (iteration-- > 0)
{
    curr = GetNextPermutation();
    best = Min(best, curr)
    if (AcceptedLimit(curr)) break;
}
DoSomething(best);
You have to design (not implement) first the GetNextPermutation() function, the Min() function, and the AcceptedLimit() functions.
Once you have an idea on these, you may talk about implementing these.
Cheers
Andi
  Permalink  
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 539
1 Maciej Los 300
2 DamithSL 233
3 Sergey Alexandrovich Kryukov 209
4 BillWoodruff 200
0 OriginalGriff 7,168
1 Sergey Alexandrovich Kryukov 6,377
2 DamithSL 5,461
3 Manas Bhardwaj 4,876
4 Maciej Los 4,450


Advertise | Privacy | Mobile
Web02 | 2.8.1411023.1 | Last Updated 18 Feb 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100