Path: news.mathworks.com!not-for-mail
From: "Rakesh Kumar" <rkumar@mathworks.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Fmincon + Ansys, Looking for a global minimum
Date: Tue, 5 Dec 2006 10:07:47 -0500
Organization: The MathWorks, Inc.
Lines: 91
Message-ID: <el4205$7h4$1@fred.mathworks.com>
References: <1164841726.133763.24890@j72g2000cwa.googlegroups.com>   <ef473bb.0@webcrossing.raydaftYaTP> <1164921803.302933.143550@80g2000cwy.googlegroups.com>
Reply-To: "Rakesh Kumar" <rkumar@mathworks.com>
NNTP-Posting-Host: kumarr.dhcp.mathworks.com
X-Trace: fred.mathworks.com 1165331269 7716 144.212.219.136 (5 Dec 2006 15:07:49 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 5 Dec 2006 15:07:49 +0000 (UTC)
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2869
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2962
Xref: news.mathworks.com comp.soft-sys.matlab:382196



 You can try using some evolutionary algorithms or even better some form of 
hybrid scheme (evolutionary & classical together) to maximize your chances 
of finding a global minimum. If you have access to Genetic Algorithm and 
Direct Search Toolbox, you may try one of two schemes:

- Use PATTERNSEARCH function with a search step. here are the options I 
would use to find a global minimum.

options = 
psoptimset('SearchMethod',{@searchlhs,10},'InitialMeshSize',10,'Display','iter')

% Call patternsearch
[R,weight,exit,output] =
 patternsearch(@obj,R0,M,b,Meq,beq,lb,ub,@cons,options)

You can play with options such as 'InitialPenalty' and 'PenaltyFactor' if 
nonlinear constraints are not easily satisfied.


- Use GA with FMINCON as hybrid function
options = gaoptimset('HybridFcn',@fmincon, 'PopulationSize', 
200,'Generations',500,'MutationFcn',@mutationadaptfeasible,'Display','iter');

% Call ga
[R,weight,exit,output] =
 ga(@obj,numel(R0),M,b,Meq,beq,lb,ub,@cons,options)

Note that the second input argument to GA is numel(R0) i.e., number of 
variables.

hth,
Rakesh

<strefli3@gmail.com> wrote in message 
news:1164921803.302933.143550@80g2000cwy.googlegroups.com...
> Dmitrey,
> I have downloaded OpenOpt and read all the documentation, but I can't
> seem to implement it into my current situation. Let me exaplain how I
> use fmincon
>
> [R,weight,exit,output] =
> fmincon(@obj,R0,M,b,Meq,beq,lb,ub,@cons,options)
>
> Breaking it down:
> @obj represents my objective function, this is simply the weight of the
> truss which is then scalled to be a reasonable. In other words it is
> each design variable, which is a the radius of the bar squared, *pi *
> length.
>
> R0 is my initial guess to the problem
>
> M,b,Meq,beq are all empty
>
> lb and ub are my upper bounds and lower bounds of the design variables.
>
> @cons is a function that calls Ansys which the retuns stresses for each
> bar and then @cons converts them to contraints based on the maximium
> allowable stress.
>
> So my question is, How do I call OpenOPT with my in the way that I use
> fmincon; using the @cons function to determine the contraints?
>
> Thanks for the tips thus far.
>
> Dmitrey wrote:
>> Hi strefli3
>> If you are interested in local-global solvers, I would propose you to
>> try hPSO from OpenOpt
>> It was written by Alexandros Leontitsis & we make some changes - for
>> example, replaced inner solver from MATLAB fminsearch to Shor r-alg
>> with AST. However, currently it can handle non-linear constraints via
>> N*max(0, c(x)), where N is a big number; on the other hand, in a very
>> sucsessful way.
>> however, it's 1st-order optimizer & don't use user-supplied Hesse
>> matrix (but can use (sub)gradient info)
>> Lates Openopt version is available at
>>  <http://www.box.net/public/6bsuq765t4>
>> if you'll find the OpenOpt usefull please make a good review at
>> 
>> <http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=13115&objectType=file>
>> OpenOpt also includes GAConstrain solver, which can handle c(x)<=0
>> & Ax<=b; also you must provide lb, ub. However, as all global
>> solvers, it can handle only small-scaled problems with nvars ~1...15
>>
>> You can try non-smooth solver fminsearchOS (free, use web search) or
>> snopt() from TOMLAB - they propose 21 evaluation ver, but their
>> prices are not for everyone.
>> best regards, Dmitrey
>