Friday 9 November 2012

C# - Algorithm: AccountForEfficiencies()

Status: Running
vWorker link.
Competition start date: 2012.11.10
Competition end date: 2012.12.10
Download associated files from github (or fork the project)

Please make sure to read the Welcome page for general competition guidelines.
If you would like to participate in this competition please register an account on vWorker.com

Update:

2012.11.11: Fixes to the unit test have been committed to github. (Thanks quicks01ver)
2012.11.12: New fixes to the unit test have been committed to github. (Thanks Moustafa)
2012.11.13: Fixes to the unit test have been committed to github. (Thanks quicks01ver)
2012.11.19: Added some Benchmarks and committed to github. Some submissions are now failing, please check your code against these benchmarks by running the unit tests.
2012.11.21: Fix to benchmarks committed to github. (Thanks thcristo)
2012.12.03: Added Performance results obtained with Nperf
2012.12.04: Updated Performance results (Removed memory plots)

Performance Results:

Click on the images to see the original size.





Introduction:

In the manufacturing industry we often have to schedule tasks that last for a certain duration.

Most of the time the assumption is the task is running at 100% efficiency.

This is not always the case, and the purpose of this competition is to account for periods of inefficiency ( less than 100%) or periods of super efficiencies (> 100%).

In other words the task can be affected by calendar periods that have different efficiencies. This will become clearer when looking at the examples below and the unit tests.

The purpose of this competition is to implement the AccountForEfficiences() method so that it passes all the unit tests defined at https://github.com/Orcomp/Orcomp/tree/AccountForEfficiencies/Orc.Tests/DateIntervalExtensionsAccountForEfficiencies

The winner of this competition will be chosen from the submissions that pass all unit tests, has the cleanest implementation and is fast (but not necessarily the fastest.)

Submissions will be open for review once the competition is completed.

There will be prize moneys for the 3 best submissions, which will be chosen at our discretion.
1st Prize: $300
2nd Prize: $100 (Paid as an instant bonus)
3rd Prize: $50 (Paid as an instant bonus)

In order to get the code, you can either download the attached zip file or fork the github project: https://github.com/Orcomp/Orcomp

Please only submit the DateIntervalExtensions.cs file.

Important Notice:

  • More unit tests will be added, and some may be fixed during the length of the competition, so you must make sure you always have the latest code from the github repository.
  • The winning code must pass all unit tests, even those that are added during the course of the competition.
  • $10 will be awarded as an instant bonus to the first person who identifies a problem with a unit test. (i.e. $10 per unit test with a problem, but you have to be the first to report it by posting to https://groups.google.com/forum/#!forum/orcomps)
  • $10 will be awarded as an intant bonus to anyone who submits a new unit test that deals a scenario that is not already covered by an existing unit test. (Again please post it on https://groups.google.com/forum/#!forum/orcomps)

Examples:

Here are a few examples which will explain what the method is supposed to do, but first here are a few conventions:

We will define efficiency intervals by a "pipe" at either end of the interval like this:

|------------------------|

We will define the duration of a task by "plus" signs at either end of the interval like this:

+-----------+

So if a task is meant to take one hour at 100% efficiency, the task will take one hour.

Example 1
        +----------+             Duration: 1 hour
|-----------------------------|  Efficiency: 100%
Result:
        +----------+            Duration: 1 hour
Example 2
        +----------+            Duration: 1 hour
|-----------------------------| Efficiency: 50%
Result:
        +--------------------+  Duration: 2 hours
Example 3
        +----------+            Duration: 1 hour
|-----------------------------| Efficiency: 200%
Result:
        +----+                  Duration: 0.5 hours
In the examples above we assumed the start time remained fixed. For this competition the AccountForEfficiency() method has a parameter which specifies whether the start or the end remain fixed.
If the end remained fixed then our examples would look like:
Example 4
        +----------+            Duration: 1 hour
|-----------------------------| Efficiency: 100%
Result:
        +----------+            Duration: 1 hour
Example 5
        +----------+            Duration: 1 hour
|-----------------------------| Efficiency: 50%
Result:
+-------------------+           Duration: 2 hours
Example 6
        +----------+            Duration: 1 hour
|-----------------------------| Efficiency: 200%
Result:
             +----+            Duration: 0.5 hours

The unit tests also cover the situation when an efficiency is 0%.

Where it becomes interesting is when the timeline has multiple efficiency intervals which may or may not overlap each other.

RULES:
  • If efficiency intervals overlap then the one with the highest priority will be used for the calculation.
  • If two efficiency intervals have the same priority the one with the lowest efficiency has precedence and will be used in the calculation.
  • You are allowed 5 submissions.
  • You are responsible to make sure your unit tests are in sync with https://github.com/Orcomp/Orcomp

No comments:

Post a Comment