fgoalattain (Optimization Toolbox)
fgoalattain (Optimization Toolbox)
(OP)
Continuing on with my quest in optimization, I am looking to find a particular solution using a multi-objective optimization function. My design variables would be BDLT, BALPHA, BALPHY, and BPHIP. Fx, Fy, Fz, Mx, My, Mz would be the objective. The function takes the following form:
[Fx, Fy, Fz, Mx, My, Mz] = aFunc(BDLT, BALPHA, BALPY, BPHIP)
%(where BDLT is a 1x4 Matrix)
After reading up on the optimization functions in Matlab, it looks as though the function fgoalattain would be best for a nonlinear, multiobjective function. I set up my solver as such:
XO = [0 0 0 0 0 0 0] % Set initial values to 0; steady state
goal = [0 1 0 0 1 0]; % This is the value that I want to set for [Fx, Fy, Fz, Mx, My, Mz]
weight = abs(goal); % Equal weight to all goal values
options = optimset('Display', 'iter'); % Set display parameter
[X, fval, attainfactor] = fgoalattain('aFunc', XO, goal, weight, [], [], [], [], [], [], [], options);
I put seven []'s, which should be the seven outputs I want: [BDLT(4), BALPHA, BALPHY, BPHIP]. By my understanding, X should output a vector with the seven values I want, given the defined goal. I receive the following error:
??? Input Argument "BALPHA" is undefined.
Error in ++> fgoalattain at 371
user_f = feval(funfcn(3), x, varargin(:));
When BALPHA is one of the variables I am trying to solve for! I'm sure that I'm just not understanding my input and output vectors correctly, but I can't see where I'm going wrong. Do I need to change some of my variables to constraints? Thanks in advance for your thoughts.
[Fx, Fy, Fz, Mx, My, Mz] = aFunc(BDLT, BALPHA, BALPY, BPHIP)
%(where BDLT is a 1x4 Matrix)
After reading up on the optimization functions in Matlab, it looks as though the function fgoalattain would be best for a nonlinear, multiobjective function. I set up my solver as such:
XO = [0 0 0 0 0 0 0] % Set initial values to 0; steady state
goal = [0 1 0 0 1 0]; % This is the value that I want to set for [Fx, Fy, Fz, Mx, My, Mz]
weight = abs(goal); % Equal weight to all goal values
options = optimset('Display', 'iter'); % Set display parameter
[X, fval, attainfactor] = fgoalattain('aFunc', XO, goal, weight, [], [], [], [], [], [], [], options);
I put seven []'s, which should be the seven outputs I want: [BDLT(4), BALPHA, BALPHY, BPHIP]. By my understanding, X should output a vector with the seven values I want, given the defined goal. I receive the following error:
??? Input Argument "BALPHA" is undefined.
Error in ++> fgoalattain at 371
user_f = feval(funfcn(3), x, varargin(:));
When BALPHA is one of the variables I am trying to solve for! I'm sure that I'm just not understanding my input and output vectors correctly, but I can't see where I'm going wrong. Do I need to change some of my variables to constraints? Thanks in advance for your thoughts.
RE: fgoalattain (Optimization Toolbox)
The closer to the actual solution you guess, the better off the solver will be.
TTFN
FAQ731-376: Eng-Tips.com Forum Policies
RE: fgoalattain (Optimization Toolbox)
x = fgoalattain(func, xO, goal, weight)
which tries to make the objective functions supplied by func attain the goals specified by goal by varying x, starting at xO. So xO should be the 'initial guess', correct?
I've tried to further simplify the form of my equation by:
[BDLT, BALPHA, BALPHY, BPHIP] = fgoalattain('aFunc', XO, goal, weight)
Where I get the same error message as previously mentioned. I know that I want BALPHY, BPHIP to be 0, and vary BDLT, BALPHA to achieve the goal.
I've been spinning my gears on this one and not making any progress. My next step is to continue reading and maybe I'll get a better understanding of this.