how to keep gamultiobj goals positive

Hello,
I am trying to optimise a function using the GAMULTIOBJ tool, the function takes a 12x1 input vector and returns a 2x1 output vector, the input vector is the variables of the optimisation and the output are the goals that its trying to minimise. The problem is any time I try to run the optimisation the goals are negative numbers, I need to ensure that they stay positive. How do I put constraints on the goals alone but leave the input vector unconstrained?
Many thanks

 Accepted Answer

Alan Weiss
Alan Weiss on 19 Oct 2017
If you have R2014b or later, use a nonlinear constraint function. Use one nonlinear constraint for each objective function. To save time, after debugging your constraints, you might want to use the technique in Objective and Nonlinear Constraints in the Same Function.
Alan Weiss
MATLAB mathematical toolbox documentation

7 Comments

Thanks Alan,
I will look into that. :)
Alan,
I was using a nonlinear constraint function, in order to keep x1 and x2 positive I created a function as follows
function [c,ceq] = mycon(x)
c(1) = -x(1);
c(2) = -x(2);
ceq = [];
end
however it doesn't seem to be having an effect.
Don't use nonlinear constraints to constrain your decision variables to be positive. Use bounds for that. Use nonlinear constraints to bound nonlinear functions of the decision variables. See Types of Constraints.
Alan Weiss
MATLAB mathematical toolbox documentation
Hi Alan
Thanks for your help, does the bound constraint work on the output of the function? I thought they only bound the input variables vector.
Steven
No, bounds work on the decision variables, the x variables, not the output. I made the comment because you set
c(1) = -x(1)
which means your nonlinear constraint was trying to keep the input variable x(1) positive.
Alan Weiss
MATLAB mathematical toolbox documentation
Ah right, I using the GAMULTIOBJ tool, can you constrain the output to be positive?
I have achieved what I need with the FGOALATTAIN multi-objective tool but id rather use the GA one if possible.
Steven
As I stated in my original answer, if you have R2014b or later, then yes, gamultiobj accepts nonlinear constraints. Otherwise, no.
Alan Weiss
MATLAB mathematical toolbox documentation

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!