-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replaced Genetic's Serial SGS with Parallel SGS - added can_schedule_at_the_moment method to all timelines - updated ZoneTimeline with the ability to handle non-zero status change costs - added GeneralTimeline to handle abstract objects in time - added LinkedList data structure with iterators to handle remove-on-iteration operations Parallel SGS is much more applicable to handle many constraints than Serial SGS because it depends on constraints checking method, not on find minimum satisfaction time. In SAMPO we have renewable and non-renewable resources and zones, so it's true for us :)
- Loading branch information
1 parent
cd7a1e8
commit d0fe329
Showing
20 changed files
with
514 additions
and
203 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[tool.poetry] | ||
name = "sampo" | ||
version = "0.1.1.220" | ||
version = "0.1.1.222" | ||
description = "Open-source framework for adaptive manufacturing processes scheduling" | ||
authors = ["iAirLab <[email protected]>"] | ||
license = "BSD-3-Clause" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
from typing import TypeVar, Generic | ||
|
||
from sortedcontainers import SortedList | ||
|
||
from sampo.schemas.time import Time | ||
from sampo.schemas.types import EventType | ||
|
||
T = TypeVar('T') | ||
|
||
|
||
class GeneralTimeline(Generic[T]): | ||
""" | ||
The representation of general-purpose timeline that supports some general subset of functions | ||
""" | ||
def __init__(self): | ||
# ScheduleEvent = time, idx, object | ||
def event_cmp(event: Time | tuple[EventType, Time, int, T]) -> tuple[Time, int, int]: | ||
if isinstance(event, tuple): | ||
return event[1], event[2], event[0].priority | ||
|
||
if isinstance(event, Time): | ||
# instances of Time must be greater than almost all ScheduleEvents with same time point | ||
return event, Time.inf().value, 2 | ||
|
||
raise ValueError(f'Incorrect type of value: {type(event)}') | ||
|
||
self._timeline = SortedList(iterable=((EventType.INITIAL, Time(0), -1, None),), key=event_cmp) | ||
self._next_idx = 0 | ||
|
||
def update_timeline(self, start_time: Time, exec_time: Time, obj: T): | ||
self._timeline.add((EventType.START, start_time, self._next_idx, obj)) | ||
self._timeline.add((EventType.END, start_time + exec_time, self._next_idx, obj)) | ||
self._next_idx += 1 | ||
|
||
def __getitem__(self, index) -> Time: | ||
""" | ||
Returns the time of checkpoint on `index` | ||
""" | ||
return self._timeline[index][1] | ||
|
||
def __len__(self): | ||
return len(self._timeline) |
Oops, something went wrong.