Finding minimum efficiency reduction in multiple turbine setup (fmincon)

My problem: To design a hydropowerplant setup. Given indivudual effiency functions for three different turbine-options, I want to calculate the distrubution of water flow of all possible combinations that minimizes the effiency reduction.
Since there are three turbine types to pick from, there are three possible dual-turbine setups. All turbines have a optimal waterflow, aswell as a maximum waterflow. The hydropowerplant also has a maximum waterflow, and any given waterflow will be distributed amongst the two turbines.
The problem is how much water each turbine should get, optimally.
if true
% clear all; clc; clf; sympref('HeavisideAtOrigin',0);
%
% WF = [0:0.25:110];
% F1 = 0.105 + 0.2*(WF(1:find(WF == 47))./35-1).^2;
% F2 = 0.100 + 0.3*(WF(1:find(WF == 38))./30-1).^2;
% F3 = 0.103 + 0.1*(WF(1:find(WF == 33))./24-1).^2;
% F1 = [1-F1 zeros(1,length(WF)-length(F1))];
% F2 = [1-F2 zeros(1,length(WF)-length(F2))];
% F3 = [1-F3 zeros(1,length(WF)-length(F3))];
%
% fun = @(X) heaviside(X(1))*(0.105 + 0.2*((X(1))/35-1)^2) + heaviside(X(2))*(0.100 + 0.3*((X(2))/30-1)^2);
% A = [];
% b = [];
% Aeq = [1,1];
% beq = 0;
% lb = [0,0];
% ub = [47,38];
% X0 = [0,0];
% Fmin = zeros(1,length(WF));
% Xtemp = zeros(2,1);
%
% for i = 1:length(WF)
% beq = WF(i);
% Xtemp = fmincon(fun,X0,A,b,Aeq,beq,lb,ub);
% X0 = Xtemp;
% Fmin(i) = 1 - (heaviside(Xtemp(1))*(0.105 + 0.2*((Xtemp(1))/35-1)^2) + heaviside(Xtemp(2))*(0.100 + 0.3*((Xtemp(2))/30-1)^2));
% end
%
%
% hold on;
%
% plot(WF,F1); plot(WF,F2); plot(WF,F3); plot(WF,Fmin);
end
While the code is not written in the praxis of good script, I hope it is clear what all values are. The thing I need help with is understanding why the minimizing function clearly isnt working. Is it the heaviside? Is it the fmincon?
All help is appreciated.

Answers (1)

fmincon is for optimizing smooth functions with smooth constraints. By putting find and heaviside statements in your script, you destroy smoothness, and fmincon will not move from its initial point.
Do you really need these statements? I guess not. Instead, you can search over particular smooth regions. You are free to set bounds on the total water flow and the flow of each turbine. Just keep it all smooth, no case statements, find, or the like. Remember, fmincon tries to estimate local derivatives by making very small changes in X, and estimating gradients numerically. When you have statements like find, you usually end up with estimated gradients of zero, and fmincon halts immediately.
Alan Weiss
MATLAB mathematical toolbox documentation

Categories

Asked:

on 15 Nov 2017

Answered:

on 15 Nov 2017

Community Treasure Hunt

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

Start Hunting!