"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.
> "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.