how to define constraint on objective function in ga toolbox?

hi, this my optimization code:
lb=[0.01,0.0075,0.01];
ub=[0.2,0.07,0.07];
func=@efficiency;
[x,fvar]=gamultiobj(func,3,[],[],[],[],lb,ub);
plot(fvar(:,1),fvar(:,2),'o');
I have 3 decision variable sand two objective functions which are electrical and thermal efficiencies, so these efficiencies can not be higher that 100%, but ga calculated efficiencies higher than 100%. How can I define constraint (efficiencies <100%) on objective functions?

11 commentaires

Are lb and ub bounds on the efficiencies ? But you want to optimize the process - so why do you set upper bounds ?
And what value becomes greater than 1 ?
lb and ub are on my decision variables. I want to find maximum of efficiencies but the efficiency can not be more than 100%.
And how do you get efficiency from your decision variables ? In other words: How does your objective function looks like ?
I wrote a function for my objective function, it is a physical proble, it is not a simple code.
Can the numerical values for the efficiencies you calculate in the objective function become greater than 1 ? If yes: return min(1,efficiency) to ga or use nonlcon to limit efficiencies to 1 by the nonlinear constraint c(d1,d2,d3) <= 1.
I can not understand your meaning. Would you pleaseexplaine more? Would you please tell me how to write your answer in my code?
Torsten
Torsten le 4 Oct 2022
Modifié(e) : Torsten le 4 Oct 2022
Please answer the questions:
Does your objective function return efficiency as value to be maximized ?
o Yes o No
If yes, is it possible that the numerical value computed in the objective function for the efficiencies exceeds 1 ?
o Yes o No
If yes, define c(x) in function nonlcon such that efficiencies = c(x) <= 1.
The answer to first question: yes. Efficiency should be maximum, but considering that GA gets the minimum, I set the objective function equal to the negative efficiency.
The answer to second question: yes.
As I said, my objective function is not a simple function that I can define like c(x).
Just copy what you calculate in the objective function to the function nonlcon to define c(x). What's the problem ?
No problem Thanks.
Torsten
Torsten le 6 Oct 2022
Modifié(e) : Torsten le 6 Oct 2022
To avoid duplicate code: Write a function where you compute the values of the objective function(s) and call this function from your objective as well as from nonlcon.

Connectez-vous pour commenter.

Réponses (0)

Produits

Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by