Three inequality constraints for multi-objective genetic algorithm
조회 수: 16 (최근 30일)
이전 댓글 표시
I have been trying to specify inequality constraints to minimise a multi objective function. The constraints are:

> 0
>0my code is as follows
function y = objectivef(x)
y(1) = x(1).^2 - x(2);
y(2) = -0.5*x(1) - x(2) - 1;
end
clc
clear all
ObjectiveFunction = @objectivef;
nvars = 2; % Number of variables
LB = [-7 -7]; % Lower bound
UB = [4 4]; % Upper bound
ConstraintFunction = @myconstraints;
[x,fval] = gamultiobj(ObjectiveFunction,nvars,[],[],[],[],LB,UB, ...
ConstraintFunction)
%this is what I need help with
function [c ceq] = myconstraints(x)
c = [6.5 -x(1)/6 -x(2);7.5 -0.5*x(1) -x(2);30 - 5*x(1) - x(2)];
ceq = []
end
댓글 수: 0
채택된 답변
Alan Weiss
2020년 10월 14일
These are linear constraints, so you should not use a nonlinear constraint function (which has errors in signs in any case: you have to ensure that the inequalities all go the correct way). Try this instead:
A = [1/6 1
1/2 1
5 1];
b = [6.5;7.5;30];
[x,fval] = gamultiobj(ObjectiveFunction,nvars,A,b);
Alan Weiss
MATLAB mathematical toolbox documentation
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Genetic Algorithm에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!