Questions tagged [simpy]

A discrete-event simulation framework for Python

SimPy is a process-based discrete-event simulation framework based on standard Python. Its event dispatcher is based on Python’s generators and can also be used for asynchronous networking or to implement multi-agent systems (with both, simulated and real communication).

341 questions
1
vote
2 answers

Compute the total time for which the simulation ran in simpy

I am using env.run() to run the simulation and my simulation contains a bunch of processes which wait for each other and process some event. Now I know when we don't specify the time frame for which the simulation should run then the simulation runs…
bakas
  • 323
  • 2
  • 11
1
vote
1 answer

Can I run two Simpy environments in parallel

I would like to model two processes: (1) A simple real-time message broadcaster (deterministic) and (2) Another process which receives data externally in real-time (from a Redis db) and then compares its own message to the value of the last message…
GlaceCelery
  • 921
  • 1
  • 13
  • 30
1
vote
0 answers

Python method for simulation similar to R

I have manufactoring problem that I want to simulate in python. There are different types of jobs and each jobs has a set amount of manufactoring orders. For example it could be that you are manufacturing different types of vehicles, like a car with…
Ana
  • 51
  • 5
1
vote
1 answer

Python boolean expression

I want to save booleanexpressions into file in most memory effective way. There are some relations between the booleans that do not need to be saved into file, but are assumed. One of my ideas is to save it in DNF, that skips the lines, that are…
user2952903
  • 365
  • 2
  • 10
1
vote
3 answers

Simpy queue simulation

I'm trying to simulate a queue with limited buffer where no packet is dropped but kept in waiting . Bear with me since I'm just a student with basic coding skills. The packet arrive exponentially distributed and each hold a packet size with mean…
1
vote
1 answer

Python AttributeError: class has no attribute

I have this code with a class queue which consist of simpy Resource and Container (buffer): class queue: def __init__(self, env): self.port = simpy.Resource(env, capacity=1) self.buffer = simpy.Container(env, init = 0,…
fieq.fikri
  • 73
  • 3
  • 13
1
vote
0 answers

simulatation of multiple locations inventory based on markov decision process in python and simpy

I would like to implement the multiple location inventory based on markov decision process with python specially sympy but as I am not expert in python and inventory management I have some problems. I want to implement based on formula of page 12,…
1
vote
0 answers

How to implement work stealing in SimPy 3?

I want to implement something akin to work stealing or task migration in multiprocessor systems. Details below. I am simulating a scheduling system with multiple worker nodes (resources, each with multiple capacity), and tasks (process) that arrive…
cabad
  • 4,555
  • 1
  • 20
  • 33
1
vote
1 answer

I am unable to understand the execution flow in the following code. Unable to explain the error as well as output

In the following code snippet, I am trying to understand the simpy tutorial. I am unable to explain the output. I expect all the "\o/" to be printed in one go before other statements are printed. Also, there is a problem with the callback. …
kosmos
  • 359
  • 5
  • 13
1
vote
1 answer

Release resource being held by another process

In SimPy, if I've process a, b and resource r and do: yield request, self, r #request done in process a How can I release the resource from process b? yield release, a, r #release done in b (being a an instance of class a), doesn't work I've also…
Ben
  • 16,275
  • 9
  • 45
  • 63
1
vote
1 answer

How to interrupt nested processes in SimPy?

I'm trying to interrupt a set of nested processes in simpy. It appears from the following code that only the first layer of processes is interrupted by an interrupt event, and I can't seem to find a way to reference the processes defined within…
Allen Wang
  • 2,426
  • 2
  • 24
  • 48
1
vote
1 answer

Discrete Event Simulating Embedded Firmware using Simpy

Let's say I have 3 tasks: def task1(): if check_if_theres_work_to_do(): #just checking takes 2us do_work() #takes 10us task2 and task3 defined similarly and I have one CPU. A common embedded approach would be to do the following: def…
sheridp
  • 1,386
  • 1
  • 11
  • 24
1
vote
3 answers

TypeError: unsupported operand type(s) for +: 'int' and 'instance'

I'm not great with Python, I know something is messed up with my class but I am not sure what is going wrong with it. It seems like a pretty general problem but for whatever reason I am having a difficult time comprehending why. class distance: …
1
vote
2 answers

Can't install SimPy

I may be doing this incorrectly, if so please let me know. I'm trying to install SimPy using Navigator 1.6.2. I click Environments, then to the left of Channels, I select ALL, then search for SimPy. It does not appear. Yet when I look at Anaconda…
James
  • 673
  • 6
  • 19
1
vote
1 answer

Terminating SimPy simulation

I am using one of the examples in the tutorial as a basis to model call center simulation. Simulation is for one hour window (max simulation time of 60 minutes). When I execute env.run(until = 60) calls arrive even few seconds before 60 minute ends,…
young kwon
  • 11
  • 2