# Optimize, Quickly!4

Posted by Brett Shoelson,

### Contents

Brett's Pick this week has three components. All are by MathWorker Stuart Kozola, and all will help you become an expert user of our optimization tools. We frequently present and record Webinars that are available for free download and viewing. Stuart is a technical marketing guru who focuses on our math and data analysis tools. Whenever a Webinar focuses on optimization, Stuart is sure to be behind the scenes, if not in front of the microphone!

### Getting Started with Optimization

First, I would like to share Stuart's link to the files used in the August 21, 2008 Webinar entitled "Tips and Tricks: Getting started using optimization with MATLAB". In that session, Stuart provides an overview of Optimization Toolbox and Global Optimization Toolbox with several examples, ranging from constrained curve fitting to general maximization problems. Stuart steps through a totally-cool illustrative example of maxima detection by attempting to locate the highest peak in a range of mountains. (Here, we can think of the topography as a analogy for an objective function.)

### Global Optimization

Next, Stuart turns his attention to the problem of finding global optima from search domains that may include local maxima or minima: For these problems, our Global Optimization Toolbox can be quite useful. In a Webinar entitled " Global Optimization with MATLAB Products," Stuart shared a wealth of information about different types of optimization problems, including those for which a genetic algorithms is appropriate. Here is the File Exchange link to the files used in that Webinar.

### Parallelizing Optimization Solutions

Finally, Stuart describes an approach to speeding up optimization problems, providing instruction for using the Parallel Computing Toolbox and MATLAB Distributed Computing Server to parallelize the calculation of optima. In this Webinar, Stuart minimizes the potential energy of electrons on a conducting body. He solves the optimization problem without the Parallel Computing Toolbox in about 84 seconds. Next, he opens a non-local 4-core cluster and re-solves the problem in parallel, simply by checking an "evaluate in parallel" checkbox. This time the same problem is solved in 25 seconds--approximately a 3.4x speedup. Not bad for checking a checkbox! Comments?

Get the MATLAB code

Published with MATLAB® 7.11

### Note

Comments are closed.

## 4 CommentsOldest to Newest

Ehsan Heidari replied on : 1 of 4

Dear Brett,
I’m MSc student in control engineering and my area of research is optimization. Unfortunately I live in Iran and I can’t see the webinars. Would you please give me the files of your this post?
I’m waiting for your kind reply.

Best Regards,
Ehsan Heidari
e.heidari2005@gmail.com

Brett replied on : 2 of 4

Hi Ehsan,
It appears that your inability to access our website has to do with our OFAC compliance; unfortunately, we are unable at this time to provide content or web access to Iran-based computers.
Best regards,
Brett

Tobias replied on : 3 of 4

Hi Brett,

Is it possible to use a genetic algorithm or something for trading application. basically, i have a model which tries to find the optimal sharp ratio based on two inputs of different “Take Profits” and “Stopp Losses”. So far I use two nested for-loops with the inputs ranging from 5 to 100 for each of the two variables.

Would appreciate any help.

Thanks, Tobias

Brett replied on : 4 of 4

Hi Tobias,
I’m not a finance person, but I passed your question by one of our engineers who is. To summarize/paraphrase his response:

It sounds like Tobias is just trying to do a two-variable optimization. FMINCON will do nicely, since Sharpe Ratio surfaces tend to be conveniently convex.

If he’s having issues of integer constraints or multiple maxima, then Global Optimization methods will be better.

In short, you might be able to use GA for that problem, but you’re better off trying something like FMINCON first.

HTH,
Brett