Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can you please elaborate the Synchronization code #16

Open
div-Ai opened this issue Apr 28, 2023 · 0 comments
Open

Can you please elaborate the Synchronization code #16

div-Ai opened this issue Apr 28, 2023 · 0 comments

Comments

@div-Ai
Copy link

div-Ai commented Apr 28, 2023

Hi what is t can you please explain and also what is base timer and time limits I mean the [5,30] in the list what are these values. If you can please elaborate it helps a lot.
Synchronization logic:
f = open("out.txt", "r")
no_of_vehicles=[]
no_of_vehicles.append(int(f.readline()))
no_of_vehicles.append(int(f.readline()))
no_of_vehicles.append(int(f.readline()))
no_of_vehicles.append(int(f.readline()))
baseTimer = 120 # baseTimer = int(input("Enter the base timer value"))
timeLimits = [5, 30] # timeLimits = list(map(int,input("Enter the time limits ").split()))
print("Input no of vehicles : ", *no_of_vehicles)

t = [(i / sum(no_of_vehicles)) * baseTimer if timeLimits[0] < (i / sum(no_of_vehicles)) * baseTimer < timeLimits[1] else min(timeLimits, key=lambda x: abs(x - (i / sum(no_of_vehicles)) * baseTimer)) for i in no_of_vehicles]
print(t, sum(t))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant