Quantcast
Viewing all articles
Browse latest Browse all 130

Re: optimization problem

"Torsten" wrote in message <megiga$9h6$1@newscl01ah.mathworks.com>...
> "107" wrote in message <mef9lc$6gc$1@newscl01ah.mathworks.com>...
> > "Torsten" wrote in message <medvua$hpj$1@newscl01ah.mathworks.com>...
> > > "107" wrote in message <mecm3h$cpo$1@newscl01ah.mathworks.com>...
> > > > Hi Torsten, thanks for your reply.
> > > > I had another go at it and this is what I came up with:
> > > >
> > > > objective function:
> > > > speed = -x(1);
> > > > comment: basically it can be varied freely as long as the constraints are fulfilled. the '-' is as the fmincon can only minimize variables. x is a vector which contains all variables so I can use it as as input in my functions when formulating the constraints
> > > >
> > > > constraints:
> > > > first I call the functions with the associated input variables (j can be any/multiple indizes in vector x)
> > > > [FXi, FYi, FZi, MXi, MYi, MZi] = fi(x(1), x(j), ...)
> > > > inequality constraints as I want some variables greater zero or below certain value
> > > > c = [-x(j); x(k)-y; ...]
> > > > equality constraints are basically the sum of all moments and forces
> > > > ceq = [sum(FX); sum(FY); sum(FZ); sum(MX); sum(MY); sum(MZ)]
> > > >
> > > > Does this sound about right or is it going into a completely wrong direction?
> > >
> > > The inequality constraints look linear in the solution variables - thus you should define them as A*x<=b (matrix A and vector b are arguments in the call to fmincon).
> > > The other settings look correct to me.
> > >
> > > Best wishes
> > > Torsten.
> >
> > Thanks for your reply.
> > What is the difference between defining the inequality constraints with the matrix and vector you suggested and my vector? is it just more elegant or are there advantages in solvin speed etc. ?
>
> I don't know exactly fmincon's algorithm. If MATLAB expects the user to separate linear from nonlinear constraints, the algorithm behind fmincon will take advantage out of this separation. I guess it is because the linear constraints can be excluded from the nonlinear Newton iteration and will enter in the solution of linearized subproblems only (performed by linprog), but it's only a guess.
> If you are interested, you should consult the underlying papers concerned with fmincon's algorithm.
>
> Best wishes
> Torsten.

Hi Torsten. I was just about to implement what you suggested when I discovered that I can simply specify a lower bound for each variable, which is much easier. This also enabled me to change the tolerance for the nonlinear constraints, which should reduce the number of iterations. I cannot really tell of there is a difference in solving speed, but I discovered that the CPU-usage changed. I am running the optimizer in parallel on 4 cores and with all constraints in the nonlinear constraints function they are used equally, now one CPU has a higher load than the three others. Memory usage is lower.

Viewing all articles
Browse latest Browse all 130

Trending Articles