diff --git a/docs/images/traffic_opt.png b/docs/images/traffic_opt.png new file mode 100644 index 0000000..31ade8f Binary files /dev/null and b/docs/images/traffic_opt.png differ diff --git a/docs/index.html b/docs/index.html index f8a7bfb..1e71f64 100644 --- a/docs/index.html +++ b/docs/index.html @@ -533,23 +533,98 @@
x
.
+ We run 30 trials over different randomly generated problems. All methods see the same randomness. On
+ average, Trace is able to match the best-in-class Adam; on the other hand, without access to the full
+ computational graph, the optimizer alone struggles to find the optimal x
.
- from trace import node
+ from trace import node, GRAPH
program = NumericalProgramSampler(chain_length=7, param_num=1, max_gen_var=4)
x = node(-1.0, "input_x", trainable=True)
- z.backward(feedback="Output should be larger.", visualize=True)
+ for i in tqdm(range(n_steps)):
+ GRAPH.clear()
+
+ if feedback.lower() == "Success.".lower():
+ break
+
+ try:
+ output = program(x, seed=program_id)
+ feedback = program.feedback(output.data)
+ except TraceExecutionError as e:
+ output = e.exception_node
+ feedback = output.data
+
+ optimizer.zero_feedback()
+ optimizer.backward(output, feedback)
+ optimizer.step()
- Exercitation photo booth stumptown tote bag Banksy, elit small batch freegan sed. Craft beer elit seitan exercitation, photo booth et 8-bit kale chips proident chillwave deep v laborum. Aliquip veniam delectus, - Marfa eiusmod Pinterest in do umami readymade swag.
-Day handsome addition horrible sensible goodness two contempt. Evening for married his account removal. Estimable me disposing of be moonlight cordially curiosity.
+We tested Trace in a traffic control problem which is an instance of hyper-parameter tuning. We used UXSim to simulate traffic at a four-way intersection, where the trainable parameters are 2 integers in [15,90], which are the green light duration for each direction of traffic flow.
+Image sourced from UXSim Website
+The feedback is the estimated delay experienced by all vehicles due to intersections, and the goal of an + optimizer is to minimize the delay using the fewest number of traffic simulations. To this end, this + optimizer must find the right trade-off for temporally distributed and variable demands.
+We report the performance of a SOTA heuristic from the traffic control literature, SCATS as + well as two black-box optimization techniques: Gaussian Process Minimization (GP) and Particle + Swarm Optimization (PSO). All methods use the same starting parameters.
+GP and PSO appear bad because 50 iterations are insufficient for their + convergence; given enough iterations, both will eventually perform well. Trace is quickly competitive + with the SCATS heuristic, whereas OPRO is not. We show the code sketch below. Trace sends a node object into the simulator + and let the environment operate on it. The underlying operation logic is automatically revealed to the Trace optimizer.
+
+
+ from trace import node, GRAPH
+
+ def traffic_simulation(EW_green_time, NS_green_time):
+ W = None
+ try:
+ W = create_world(EW_green_time, NS_green_time)
+ except Exception as e:
+ e_node = ExceptionNode(
+ e,
+ inputs={"EW_green_time": EW_green_time, "NS_green_time": NS_green_time},
+ description="[exception] Simulation raises an exception with these inputs.",
+ name="exception_step",
+ )
+ return e_node
+ W.data.exec_simulation()
+ return_dict = analyze_world(W, verbosity)
+
+ return return_dict
+
+ EW_x = trace.node(MIN_GREEN_TIME, trainable=True, constraint=f"[{MIN_GREEN_TIME},{MAX_GREEN_TIME}]")
+ NS_x = trace.node(MIN_GREEN_TIME, trainable=True, constraint=f"[{MIN_GREEN_TIME},{MAX_GREEN_TIME}]")
+
+ optimizer.objective = (
+ "You should suggest values for the variables so that the OVERALL SCORE is as small as possible.\n"
+ + "There is a trade-off in setting the green light durations.\n"
+ + "If the green light duration for a given direction is set too low, then vehicles will queue up over time and experience delays, thereby lowering the score for the intersection.\n"
+ + "If the green light duration for a given direction is set too high, vehicles in the other direction will queue up and experience delays, thereby lowering the score for the intersection.\n"
+ + "The goal is to find a balance for each direction (East-West and North-South) that minimizes the overall score of the intersection.\n"
+ + optimizer.default_objective
+ )
+
+ for i in range(num_iter):
+ result = traffic_simulation(EW_x, NS_x)
+ # some steps skipped for simplicity
+ feedback = result.data
+ optimizer.zero_feedback()
+ optimizer.backward(result, feedback, visualize=True)
+ optimizer.step()
+
Photo booth stumptown tote bag Banksy, elit small batch freegan sed. Craft beer elit seitan exercitation, photo booth et 8-bit kale chips proident chillwave deep v laborum. Aliquip veniam delectus, Marfa eiusmod