GA Choosing Objectively Wrong Values

Hello!
I'm in need of experienced assistance in understanding why MATLAB's GA seems to be stuck upon returning objectively wrong values when the constraints are not limiting/forcing it. My current challenge is to see if I can beat my adviser's masters thesis on water system decision-making optimization from the 90's (he used GAMS but I am really interested in using the genetic algorithm in MATLAB). The objective function is below, but the basic problem setup is:
For a theoretical city, there are 17 possible future water supply scenarios and 7 estimated demand scenarios, each having not only a differing possible water supply and water demand, but differing costs for actions like transferring water from another city (see attached image). By looking at every combination of scenarios (taking the statistical estimate) they want to determine the capacity of a desalination plant to build when available water doesn't meet requirements, and then the rate at which to operate that plant, rate at which they should transfer water, and possible rate of allowable shortage (a non-linear, theoretical political cost). Also attached is an image of the objective function and a description of the constraints.
Therefore, there are 358 decision variables (X1 being the capacity of the plant to build and then 357 variables detailing how much water to supply via desalination, how much to transfer from another city, and how much to allow as shortage for each combination [17 supply * 7 demand scenarios * 3 decisions per combination = 357]).
Here is my fitness function
function y = simple_multiobjective(x)
%Define intial variables
s = evalin('base', 's');
r = evalin('base', 'r');
a = length(s);
b = length(r);
counter = 1;
%initialize for two objectives
y = zeros(2,1);
%Create first objective
y(1) = 30000*x(1);
%Compute Second Objective
for i = 1:a
for j = 1:b
y(2) = y(2) + s(i,2)*r(j,2)*(80000 * x(1 + counter) + s(i,4) * x(2 + counter)...
+ 6000*x(3 + counter)^2);
counter = counter + 3;
end
end
Here is my setup code:
%Multiobjective
FitnessFunction = @simple_multiobjective;
nvars = 358;
LB = zeros(1,358); %lower bound
UB = 100 * ones(1,358);
A = evalin('base','constraintmat'); % No linear inequality constraints
b = evalin('base', 'bmat'); % No linear inequality constraints
Aeq = []; % No linear equality constraints
beq = []; % No linear equality constraints
[x,fval, exitFlag] = gamultiobj(FitnessFunction,nvars,A,b,[],[],LB, []);
I've attached the s and r tables, and the functions on how I made my A and b inequality matrices. When I run the code and I look at the decision variables chosen, it chooses values that are objectively the most expensive for the given situation (I fed in a vector of ones to the fitness function to see what the coefficients would be for the linear terms). I just need a little help in understanding what kind of things would cause the GA to behave like this.
Thank you for any help and I'm happy to provide more context or info as needed!

回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by