I have written a code for my problem My problem is Min L
Subject to:
0 ≤ Qt ≤ Qm
St = St-1 + It – Qt
Sd ≤ St ≤ Sm
Qt ≤ L
%Read the excel file containing time series inflow data
data = xlsread('Reservoir.xlsx');t = data(:,1); % days
I(:,1) = data(:,2); % m^3
T = data(end,1); % daysS_0 = data(1,5); % m^3S_d = data(2,5); % m^3S_m = data(3,5); % m^3Q_m = data(4,5); % m^3L = optimvar('L',1,'LowerBound',0,'UpperBound',Q_m);Q = optimvar('Q',T,'LowerBound',0,'UpperBound',Q_m);S = optimvar('L',T,'LowerBound',S_d,'UpperBound',S_m);waterbalance = optimconstr(T,1);for t = 1:T if t == 1 storage = S_0; else storage = S(t-1); end waterbalance(t) = S(t) == storage + I(t) - Q(t);enddischarge = optimconstr(T,1);for t= 1:T discharge(t) = Q(t)<=L;endprob.Constraints.waterbalance = waterbalance;prob.Constraints.discharge = discharge;prob = optimproblem;prob.Objective = L;sol = solve(prob)
I need the minimized value for L. But i am getting answer as 0. Please help me.
Best Answer