Multiobjective functions mixed with integer variables

Hello,
I write this code in matlab, and I try to run ot it gave me the error:"Nonlinear equality constraints not supported."
The code here is to maximize two functions with having 3*N varailbes which are integers [0,1]. In addition there is a constraint that limit the functions.
Can anyone help me?
Thank you in advance
% Identifying some parameters
N = 5; % number of parts
u = [4, 4, 4, 4, 4]; % usage year
L = [10, 10, 10, 10, 10]; % End-of-Life year
Ctre = [-37.29, -35.31, -46.06, 5.49, 24.17]; % Cost of treatment and disposal
Crs = ones(1,N); % Cost of reuse
Cdis = ones(1,N); % Disassembly cost
Cp = 500; % total cost of the product
EpsilonQ = 0.7; % Constraint about the quality of the recovery option
% Second we identy the 0-1 variables
Rec = optimvar('REC',3*N,'Type','integer','LowerBound',0,'UpperBound',1); % Binary value: 1 if part j is recycled, otherwise 0
% Define the inequation and the equation of the variable
Aineq = [];
Bineq = [];
Aeq = [];
Beq = [];
nlcon = @nonlcon;
fun = @objval;
% Problem solving
% Pareto search
npts = 160;
opts_ps.ParetoSetSize = npts;
[x_ps2, fval_ps2, ~, psoutput2] = paretosearch(fun, 3*N , Aineq,Bineq,Aeq,Beq,[],[],nlcon, opts_ps);
disp("Total function Count: "+psoutput2.funcount);
% Genetic algorithm
opts_ga = optimoptions("gamultiobj", "Display","off", "PopulationSize",2*npts);
[x_ga1, fval_ga1, ~, gaoutput1] = gamultiobj(fun, 3*N, [],[],[],[],[],[],nlcon,opts_ga);
disp("Total function Count: "+gaoutput1.funcount);
% Define the objective function
function F = objval(Rec)
N = 5; % number of parts
%C = Ctre * x + (Crs .* ((L-u)/L)) * y + Cdis * (x + y); % Total recovery cost of product / must be minimized
rc = [0, 3.57, 0, 24.31, 8.1]./100; % recycling rate
rs = [0.81, 0, 4.89, 24.31, 0]./100; % reuse rate
e = [10, 9.4, 10, 14, 29]./100; % CO2 saving rate
R = sum (rc .* Rec(1:N)) + sum (rs .* Rec(N+1:2*N)); % Total recovery rate of product / must be maximize
E = sum (e .* (Rec(1:N) + Rec(N + 1: 2 * N))); % Total CO2 saving rate of product / must be maximize
F = [R,E];
end
% define objective variable constraints
function [Cineq, Ceq] = nonlcon(Rec)
N = 5; % number of parts
rc = [0, 3.57, 0, 24.31, 8.1]./100; % recycling rate
rs = [0.81, 0, 4.89, 24.31, 0]./100; % reuse rate
e = [10, 9.4, 10, 14, 29]./100; % CO2 saving rate
EpsilonR = 0.5; % Constraint of total recovery rate for selected parts
EpsilonCO2 = 0.9; % Constraint of total CO2 saving rate of selected parts
u = [4, 4, 4, 4, 4]; % usage year
L = [10, 10, 10, 10, 10]; % End-of-Life year
Ceq = [];
for i=1:N
Ceq = [Ceq, Rec(i) + Rec(N + i) + Rec(2*N + i) - 1];
end
Cineq1 = (sum(rc .* Rec(1:N)) + sum(rs .* Rec(N+1:2*N)))/N;
Cineq2 = (sum(e .* Rec(1:N)) + sum(e .* Rec(N+1:2*N)))/N;
Cineq = [EpsilonR - Cineq1, EpsilonCO2 - Cineq2] ;
for i = 1:N
Cineq = [Cineq, u(i) * Rec(N+i) - L(i)];
end
end

 Accepted Answer

"Currently, paretosearch does not support nonlinear equality constraints ceq(x) = 0."
You could experiment with converting the equalities into a pair of inequalities. In terms of your code
Ceq = [Ceq, Rec(i) + Rec(N + i) + Rec(2*N + i) - 1];
after the loop you would add Ceq and -1*Ceq to the Cineq list and make sure the Ceq you return is empty.

3 Comments

Thank you for your answer, it works.
But the matlab gives me: "Unable to find a feasible point."
What should I do?
The code here is to maximize two functions
Your objective function calculates two sums. But you are using paretosearch() and gamultiobj() and those minimize not maximizes. So you should be returning the negatives of the sums in order to maximize.
This will not affect whether it is able to find any feasible points, though.
Your problem has no solution.
Look at the nonlinear equality constraints
N = 5; % number of parts
rc = [0, 3.57, 0, 24.31, 8.1]./100; % recycling rate
rs = [0.81, 0, 4.89, 24.31, 0]./100; % reuse rate
EpsilonR = 0.5; % Constraint of total recovery rate for selected parts
Cineq1 = (sum(rc .* Rec(1:N)) + sum(rs .* Rec(N+1:2*N)))/N;
Cineq2 = (sum(e .* Rec(1:N)) + sum(e .* Rec(N+1:2*N)))/N;
Cineq = [EpsilonR - Cineq1, EpsilonCO2 - Cineq2] ;
Focus on Cineq1. It has
sum(rc .* Rec(1:N))
Entries 1 and 3 of rc are 0, so that is 0.0357*Rec(2)+0.2431*Rec(4)+0.081*Rec(5) . With the entries being binary, the maximum value of that would be 0.0357+0.2431+0.081 = 0.3598
It also has
sum(rs .* Rec(N+1:2*N))
entries 2 and 5 of rs are 0 so that is 0.0081*Rec(6)+0.0489*Rec(8)+0.2431*Rec(9) . With the entries being binary, the maximum value of that would be 0.0081+0.0489+0.2431 = 0.3001.
The total of these two is 0.3598 + 0.3001 = 0.6599 . And we then divide that by N, so the maximum value of Sineq1 is 0.13198 .
Then in Cineq we subtract that value from EpislonR which is 0.5 . We are subtracting off the maximum possible Cineq1 value so we are getting the lowest possible Cineq(1) value. And that is going to be 0.5-0.13198 = 0.36802
So your Cineq(1) cannot be less than 0.36802. But for nonlinear equalities it must be 0.
So there are no possible matches for the nonlinear equalities, and your problem is impossible.

Sign in to comment.

More Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!