An Optimization Excursion

A student, Emily Wimmer, walked into my office.  She was trying to make sense of an optimization algorithm.  We worked it out and off she went to write a MATLAB program to test the algorithm on a well-behaved function. Of course, just as a mathematician instinctively looks for an counterexample to “break” a proof, I started to imagine a function that would be hard to optimize, in this case,  a prototypical hilly landscape with lots of local optima.  My idea was to use slightly perturbed Chebyshev polynomials over a restricted domain.  With a little tweaking, I had my hilly terrain.

The function is specified in this python code.

# Hilly Landscape Function

def T10X(x):
x = x +.2
y = -(512*x**10-1300*x**8+1120*x**6-400*x**4+50*x**2-1)+1*x**12+.4
return y

def T10Y(x):
x=x-.1
y = (512*x**10-1285*x**8+1120*x**6-400*x**4+50*x**2-1)-1*x**12 – .2
return y

def func2dplot(x,y):
f = -T10X(x)*T10Y(y)
return f

In the course of this investigation I found these images of awesomely weird functions and learned about python’s scipy library of optimization methods.  I tried one of them, “basinhopping,” on my function.  Hence the garish ball locating the “optimum” on the graph above.  It is evidently not the global maximum.  Thus I “broke” that particular optimization method.

All this was an excursion in the middle of excursions.  I was working on a machine learning application.  Then Emily came in with an interesting problem.  Before I could think through that problem, a biology professor had a question about curve-fitting survival curves.  I got that one lined out, then returned to the optimization.  Now I can get back to my machine learning application but who knows what other interesting problem will walk through the door.

By the way, the Jupyter system of interspersing python code and HTML has been highly useful for all these types of explorations. Recommended.

Advertisements

About jrh794

I am a sixty-five year old math instructor at Southern Oregon University. I taught at the College of the Siskiyous in Weed California for twenty-six years. Prior to that I worked as a computer programmer, carpenter and in various other jobs. I graduated from Rice University in 1967 and have a MS in Operations Research from Stanford. In the past I have hand-built a stone house and taken long solo bicycle tours. Now I ride my mountain bike and play golf for recreation.
This entry was posted in Cool Ideas, Math Explorations and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s