This puzzle has 3 levels of increasing complexity. Each "level" is separate and complete, so feel free to post partial solutions to the individual levels only.
I'm most interested in the principal questions asked in the text-boxes for level 3, but I think the 'simpler' levels are also worth considering.
The task
You are in charge of defining traffic lights and traffic signs on crossroads in your district.
Your district is in a silent backwater area, so there is zero traffic, except during rush-hour when suddenly a lot of cars drive through.
You have been charged with the task to minimize the total time traffic spends in your district, so that exhaust fumes are reduced to a minimum. You do not care about individual drivers. From your perspective, it is okay to have one person wait for the whole hour at a traffic light while all other traffic passes by - as long as the total integrated time of all traffic is minimized.
As only rush-hour is important, this puzzle counts time in seconds starting with 0 at the beginning of the rush-hour. From time 0 onwards cars will continuously arrive at the border of your district and drive in a straight line until they leave the district at the other end. Every second a car is in your district, it adds +1 to the overall "fumes" regardless of its motion.
The overall "fumes" is the property which you want to minimize.
The simplified traffic rules
For the purpose of this puzzle, traffic is described by the following, simplified rules:
A car requires 30sec to pass through one section of your district. A section is the distance between border and crossing or between two crossings. The length of these sections is of no importance, and neither is traffic level on the road. The 'space' in front of a crossing is large enough to hold all traffic, so back-queuing does not affect anything except the 'crossing time' of the following crossing as specified below. (The 30sec will only add an offset to the fume-level, but it prevents 'speeding' through the whole puzzle on no-traffic.)
Passing through a crossing does take 1 sec. (Only at green light of course!) There can only be 1 car in each direction in the crossing during this 1 sec.
If a crossing is amber or red when a driver reaches it, he will stop and stand in queue. He will stand there until it is green.
When a traffic light turns amber-to-green, starting takes each driver 1 sec per car in front to reach (and then pass) the crossing. So the first car goes immediately, the second needs 1 sec, the third 2 sec and so on. Any car which doesn't get across until the traffic light turns amber again, stops for the next green period in the new queuing position.
No car can overtake another car, nor can two cars be in the same spot at the same time. (So in a queue, the front-car will delay all others.)
Traffic light rules
Every crossing has a single, individual traffic light which will periodically go through the following cycles:
state |
: Green for North-South while red for East-Weststate X
: Amber for all directionsstate -
: Red for North-South while green for East-Weststate X
: Amber for all directions
It is up to you to define:
Variable
S
for starting state, which is the state the traffic light is in at begin of the rush-hour (0 sec). It can either bestate |
orstate -
.Variable
V
for vertical, which is the length ofstate |
in seconds .Variable
H
for horizontal, which is the length ofstate -
in seconds.Variable
A
for amber, which is the length ofstate X
in seconds.
Note that there is only a single length for the amber phases.
Also, for security reasons, the amber phase must not be shorter than 2sec
LEVEL 1 - district map and traffic
Starting with rush-hour ( 0 sec ) and immediately stopping after rush-hour ( >3600 sec ) cars will enter at the district borders as follows:
N1: A car every 7 sec starting with 0. ( 0, 7, 14, 21, ... )
S1: A car every 9 sec starting with 0. ( 0, 9, 18, 27, ... )
W1: A car every 4 sec starting with 0. ( 0, 4, 8, 12, ... )
E1: A car every 8 sec starting with 0. ( 0, 8, 16, 24, ... )
What does the ideal (single) traffic-light setting look like?
LEVEL 2 - district map and traffic
Starting with rush-hour ( 0 sec ) and immediately stopping after rush-hour ( >3600 sec ) cars will enter at the district borders as follows:
N1: A car every 24 sec starting with 0. ( 0, 24, 48, ... )
S1: A car every 24 sec starting with 2. ( 2, 26, 50, ... )
N2: A car every 15 sec starting with 2. ( 2, 17, 32, ... )
S2: A car every 19 sec starting with 0. ( 0, 19, 38, ... )
N3: A car every 14 sec starting with 14. ( 14, 28, 42, ... )
S3: A car every 14 sec starting with 2. ( 2, 16, 26, ... )
W1: A car every 15 sec starting with 0. ( 0, 15, 30, ... )
E1: A car every 10 sec starting with 10. ( 10, 20, 30 ... )
What does the ideal traffic-light setting now look like?
LEVEL 3 - district map and traffic
Starting with rush-hour ( 0 sec ) and immediately stopping after rush-hour ( >3600 sec ) cars will enter at the district borders as follows:
N1: A car every 20 sec starting with 0. ( 0, 20, 40, ... )
S1: A car every 25 sec starting with 0. ( 0, 25, 50, ... )
N2: A car every 15 sec starting with 2. ( 2, 17, 32, ... )
S2: A car every 19 sec starting with 0. ( 0, 19, 38, ... )
N3: A car every 90 sec starting with 0. ( 0, 90, 180, ... )
S3: A car every 90 sec starting with 12. ( 12, 102, 192, ... )
W1: A car every 35 sec starting with 0. ( 0, 35, 70, ... )
E1: A car every 30 sec starting with 10. ( 10, 40, 70, ... )
W2: A car every 21 sec starting with 0. ( 0, 21, 42, 63, ... )
E2: A car every 21 sec starting with 0. ( 0, 21, 42, 63, ... )
W3: A car every 26 sec starting with 0. ( 0, 26, 52, ... )
E3: A car every 26 sec starting with 3. ( 3, 29, 55, ... )
And what is the solution now?
Can the above-posed puzzle still be solved analytically or does it require simulation, approximate models or other approaches?
Note: I do *not* know the answer to this puzzle.
In particular, this also means that some of the timings of cars might have been
very badly chosen (for level 2 & 3 at least).
The goal here (for me) is to **learn** how to make this into a better puzzle.
So if you discover a problem, please put it into the comments
and be aware that the puzzle might change due to edits.