Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,20 @@ If you use our work in your research, please consider citing us with
```

## Authors
`LineFlow` was originally developed at the [University of Applied Sciences
Kempten](http://hs-kempten.de/ims) by:

- [Kai Müller](https://mueller-kai.github.io)
- [Tobias Windisch](https://www.tobias-windisch.de)
- [Martin Wenzel](https://www.hs-kempten.de/personen/martin-wenzel)

`LineFlow` gratefully acknowledges contributions from:

- Kilian Führer
- [Andreas Fritz](https://www.hs-kempten.de/personen/andreas-fritz)
- Marie Kraus

- [Kai Müller](https://mueller-kai.github.io) (University of Applied Sciences, Kempten)
- [Tobias Windisch](https://www.tobias-windisch.de) (University of Applied Sciences, Kempten)
- Martin Wenzel (University of Applied Sciences, Kempten)

## Funding

The research behind LineFlow is funded by the Bavarian state ministry of research. Learn more [here](https://kefis.fza.hs-kempten.de/de/forschungsprojekt/599-lineflow).
The research behind `LineFlow` is funded by the Bavarian state ministry of research. Learn more [here](https://kefis.fza.hs-kempten.de/de/forschungsprojekt/599-lineflow).
2 changes: 1 addition & 1 deletion lineflow/examples/multi_sink.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,5 @@ def build(self):
if __name__ == '__main__':
line = MultiSink(realtime=False, n_sinks=5, alternate=False)
agent = make_greedy_policy(5)
line.run(simulation_end=200, agent=agent, visualize=True, capture_screen=True)
line.run(simulation_end=200, agent=agent, visualize=True, capture_screen=False)
print('Produced parts: ', line.get_n_parts_produced())
33 changes: 13 additions & 20 deletions lineflow/learning/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,19 @@

def make_stacked_vec_env(line, simulation_end, reward="uptime", n_envs=10, n_stack=5):

if n_envs > 1:
env = make_vec_env(
env_id=LineSimulation,
n_envs=n_envs,
vec_env_cls=SubprocVecEnv,
vec_env_kwargs={
'start_method': 'fork',
},
env_kwargs={
"line": line,
"simulation_end": simulation_end,
"reward": reward,
}
)
else:
env = LineSimulation(
line=line,
simulation_end=simulation_end,
reward=reward,
)
env = make_vec_env(
env_id=LineSimulation,
n_envs=n_envs,
vec_env_cls=SubprocVecEnv,
vec_env_kwargs={
'start_method': 'fork',
},
env_kwargs={
"line": line,
"simulation_end": simulation_end,
"reward": reward,
}
)

if n_stack > 1:

Expand Down
1 change: 1 addition & 0 deletions lineflow/simulation/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from lineflow.simulation.stations import Sink #noqa
from lineflow.simulation.stations import Switch #noqa
from lineflow.simulation.stations import Process #noqa
from lineflow.simulation.stations import SequentialProcess #noqa
from lineflow.simulation.stations import Magazine #noqa
from lineflow.simulation.stations import WorkerPool #noqa
from lineflow.simulation.line import Line #noqa
Expand Down
29 changes: 19 additions & 10 deletions lineflow/simulation/movable_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ class Worker(object):
def __init__(self, name, transition_time=5, skill_levels=None):
self.name = name
self.transition_time = transition_time

if skill_levels is None:
skill_levels = {}
self.skill_levels = skill_levels

def register(self, env):
Expand Down Expand Up @@ -118,8 +121,9 @@ def work(self):


class Part(MovableObject):
def __init__(self, env, name, specs=None, color='Orange'):
def __init__(self, env, name, specs=None, color='Orange', nok_probability=0.0):
super(Part, self).__init__(env, name, specs=specs)
self.nok_probability = nok_probability
self._color = color

def is_valid_for_assembly(self, station_name):
Expand All @@ -142,22 +146,27 @@ def _draw(self, screen, x, y, width, height):
_part_rect = pygame.Rect(x, y, width, height)
pygame.draw.rect(screen, self._color, _part_rect, border_radius=1)

def get_processing_time(self, station):
return self.specs.get(station, {}).get("extra_processing_time", 0)

def get_error_probability(self, station):
return self.specs.get(station, {}).get("error_probability", 0.0)

def get_error_time(self, station):
return self.specs.get(station, {}).get("error_time", 0)


class Carrier(MovableObject):

def __init__(self, env, name, color='Black', width=30, height=10, capacity=np.inf, part_specs=None):
def __init__(self, env, name, color='Black', width=30, height=10, capacity=np.inf):
super(Carrier, self).__init__(env, name, specs=None)
self.capacity = capacity
self._color = color
self._width = width
self._height = height

if part_specs is None:
part_specs = {}
self.part_specs = part_specs.copy()

self._width_part = 0.8*self._width
if capacity < 15:
if capacity < np.inf:
self._width_part = self._width_part / self.capacity

self._height_part = 0.7*self._height
Expand Down Expand Up @@ -216,6 +225,9 @@ def __iter__(self):
for part in self.parts.values():
yield part

def get_parts_for_station(self, station):
return [p for p in self if station in p.specs]

def get_additional_processing_time(self, station):
total_time = 0

Expand All @@ -224,6 +236,3 @@ def get_additional_processing_time(self, station):
total_time += processing_time

return total_time



Loading