We're going to model a math puzzle as a shortest path problem. Start with the number 1. At each step, you can either tri
Posted: Wed Jul 06, 2022 11:51 am
We're going to model a math puzzle as a shortest path problem. Start with the number 1. At each step, you can either triple the current number or add one to the current number. What is the minimal number of operations (steps) needed to get from 1 to 2020? There are a few different ways to solve this problem. For full credit, build an optimization model structured as a shortest path problem. Hint: you may find the following code snippet useful: [] arcs = [] for i in nodes end append! (arcs, [(i,i+1)])