Path: blob/main/Lessons/Lesson 05 - Local Optimization/Self_Assess_Solns_05.ipynb
871 views
Self Assessment: Minimize to Maximize
193.75 is the relaxed solution, but we can't rent 193.75 apartments. Let's check 193 and 194 to see which yields a larger profit.
Bottom line: rent 194 apartments for profit $220,312.
Self Assessment: Finding Multiple Extrema
There appear to be local maxima around and while there appear to be local minima around and .
Note - there is a strange quirk here in the scipy.optimize.minimize. When we optimize without bounds result.fun
is a number, but when we optimize with bounds result.fun
is a list with one number so we have to refer to result.fun[0]
to get the number.
Self-Assessment: Rastrigin with dim = 3, dim = 4
How many iterations does it take to reliably find the global minimum with dim = 3? With dim = 4? Use the multi-start strategy.
The more local searches we perform, the better the probability of locating the global minimum at the origin. Experiment with the number of local searches to see how the reliability increases. It turns out that with dim = 3 it takes about 2000 local searches to have a 90% chance at finding the global minimum. For dim = 4 it takes about 20000 local searches.
It's possible to arrive at these numbers mathematically, but we just want you to get an idea that the number of local searches required increases dramatically as the dimension increases.
Self-Assessment: Rastrigin with dim = 10
Do 1000 local search with Rastrigin with dim = 10. What is the smallest value you find? How long do you think it would take to find the minimum from randomly chosen initial points like this?
With 1000 local searches the minimum value seems to be anywhere from 12 to 26. Increasing the number of searches helps, but it's not clear how many iterations to use, but it's likely a lot!
Self-Assessment: How many searches?
We'll start by writing a function that repeats the local search process until the global minimum is found and returns the total number of local searches.
Now we do this 100 times for each of dim = 1,2,3 and gather the results. This code may take several minutes to run.
The number of searches increases roughly by an order of magnitude (power of 10) for each added dimension.
Self Assessment: How many searches when dim = 10?
Approximately now many local searches are required to find the global minimum one time when dim = 10? Is it surprising that you (very likely) didn't find it with 1000 local searches? Explain
The number of searches would be approximately or
That's about 13 billion local searches. Even if we did 10,000 local searches per second, it would still take about two weeks to do enough to find the global minimum once:
Fortunately there are better approaches that can often deliver results in much less time!
Self Assessment: Value Balancing Local Search
For the 1000 item problem we generally achieve a local minimum max difference of groups to be anywhere from 2 to 120.