How to include two objective functions in a Goal Attainment Problem
6 views (last 30 days)
Show older comments
Hello,
I have been working on a multiobjective optimization problem that includes two objective functions:
E = (-1*(ExpUnitProfit*ExpMarkShareEWP));
F = (ExpUnitWarCost + (Pprime*(Cs*(1-ExpUnitWarCostwithoutCs))*(ExpUnitWarCostPrimes-ExpUnitWarCostwithoutCs)))/P;
I currently have my goal set to a [1x1] vector but I need it to take two separate goal values. Currently my program runs with no errors but I don't believe it utilizes the 2nd function for the goal attainment.
I've been wondering what's the best way to write in my 2 objective functions because its obviously not right. In other words: - How do I include both my objective functions? - How do you create a goal vector containing the two goals of the objective function -.04 and .2 respectively. Below is my problem.
Any help is appreciated. Thanks!
function [history,searchdir] = GoalAttainP1
% Set up shared variables with OUTFUN
history.x = [];
history.fval = [];
searchdir = [];
% call optimization
x0 = [3,2,4,8,10];
goal = [-.04];
weight = abs(goal);
options = optimset('outputfcn',@outfun,'display','iter',...
'Algorithm','active-set');
[x,fval] = fgoalattain(@MaxFunctionProblem,x0,goal,weight,[],[],[],[],[],[],@confun,options);
function stop = outfun(x,optimValues,state)
stop = false;
switch state
case 'init'
hold on
case 'iter'
% Concatenate current point and objective function
% value with history. x must be a row vector.
history.fval = [history.fval; optimValues.fval];
history.x = [history.x; x];
% Concatenate current search direction with
% searchdir.
searchdir = [searchdir;...
optimValues.searchdirection'];
plot(x(1),x(2),'o');
% Label points with iteration number and add title.
% Add .15 to x(1) to separate label from plotted 'o'
text(x(1)+.15,x(2),...
num2str(optimValues.iteration));
title('Sequence of Points Computed by fmincon');
case 'done'
hold off
otherwise
end
end
display(fval)
display(x)
P = x(1)
W = x(2)
U = x(3)
Wprime = x(4)
Uprime = x(5)
%data=round(data*100)/100
%str2num(sprintf('%5.2f',stop))
function [E,F] = MaxFunctionProblem(x)
P = x(1);
W = x(2);
U = x(3);
Wprime = x(4);
Uprime = x(5);
% Function Formulations
% Multiobjective function
Theta0 = .005;
Theta1 = .01;
Theta2 = 0.01;
Theta3 = 0.02;
L = 5;
i = 1.5;
e = 1.2;
v = (0.15*P);
Pprime = 0.2;
m = 0;
n = 6;
r = 0.0001;
vgam = 2;
Gr = 1/(n-m);
%Gr = ((exp(-r))*(r^(vgam-1)))/(gamma(vgam));
D1 = 0.2;
a = 2;
b = 0.2;
d = 0.1;
k = 1;
P1 = 1;
P2 = 6;
W1 = 1;
W2 = 5;
U1 = 1;
U2 = 6;
W3 = 10;
a2 = 0.01;
b2 = 0.005;
g = 0.1;
t = 0;
t2 = 0.0001;
r2 = 0.0001;
Inf = 50;
% Expected Unit Profit
% Unknown variables: P,W,U, Uprime, Unit Price
% P = unit price
% v = unit premium
% Expected Unit Production Costs
LtrEUPC = (Theta0+Theta1)*((m+n)/2);
FuncEct = @(t,L)(a2 + (b2/((LtrEUPC)^i)))*(1-(g*(t)));
ECTf = integral(FuncEct,t,L);
%%%%%%Expected Unit Profit %%%%%%
Lfun = @(t,r)(Theta0+(Theta1*r)+((Theta2+(Theta3*r)).*t)*Gr);
Lfun2 = @(t)((Theta0+(Theta1*r)+((Theta2+(Theta3*r)).*t)));
Sum1 = 0;
%j=1; %place holder for vector storage
L1 = integral2(Lfun,t2,W,r2,(U/W));
Dr = .0001;
for r = (U/W):Inf
% Gr = ((exp(-r))*(r^(vgam-1)))/(gamma(vgam));
Lq3 = integral(Lfun2,t,(U/r));
Sum1 = Sum1 + (Lq3*Gr*Dr);
end
L2 = Sum1;
Cs = 0.05*P;
ExpUnitWarCost = Cs*(L1 + L2);
ExpUnitWarCostwithoutCs = (L1 + L2);
ExpUnitProfit = (P + v) - ECTf - ExpUnitWarCost;
%%%%Expected Unit Warranty Costs with Uprime and Wprime
for r = (Uprime/Wprime):Inf
% Gr = ((exp(-r))*(r^(vgam-1)))/(gamma(vgam));
Lq3 = integral(Lfun2,t,(Uprime/r));
Sum1 = Sum1 + (Lq3*Gr*Dr);
end
L2 = Sum1;
ExpUnitWarCostPrimes = (L1 + L2);
%%%%%%Expected increase in market share %%%%%%
D = D1/((P1^(-a))*((W2 + k)^b)*U2^d);
Q = (D*(P^(-a))*((W + k)^b)*(U^d));
Qprime = (D*(P^(-a))*((Wprime + k)^b)*(((Uprime)^d)*((1 + v)^(-e))));
ExpIncMarketShare = (Pprime*Qprime) + ((1 - Pprime))*Q - Q;
%%%%%%Unit Price %%%%%
UnitPrice = P;
%%%%%%Market share without extension of warranty %%%%%%
MarShareWOExtWar = Q;
%%%%%%Expected Share under Enterprise Warranty Program %%%%%%
ExpMarkShareEWP = (Pprime*Qprime) + ((1-Pprime)*Q);
E = (-1*(ExpUnitProfit*ExpMarkShareEWP));
F = (ExpUnitWarCost + (Pprime*(Cs*(1-ExpUnitWarCostwithoutCs))*(ExpUnitWarCostPrimes-ExpUnitWarCostwithoutCs)))/P;
%SizeofF = size(F);
end
disp(['ExpUnitProfit = ',num2str(ExpUnitProfit)])
disp(['ExpMarkShareEWP = ',num2str(ExpMarkShareEWP)])
% disp(['E = ',num2str(E)])
% disp(['MaxFunctionProblem = ',num2str(MaxFunctionProblem)])
disp (['r = ',num2str(r)])
disp (['Theta0 = ',num2str(Theta0)])
disp (['Theta0 = ',num2str(Theta1)])
disp (['Theta0 = ',num2str(Theta2)])
disp (['Theta0 = ',num2str(Theta3)])
disp (['L = ',num2str(L)])
disp (['i = ',num2str(i)])
disp (['Qprime = ',num2str(Qprime)])
disp (['e = ',num2str(e)])
disp (['v = ',num2str(v)])
disp (['Pprime = ',num2str(Pprime)])
disp (['Gr = ',num2str(Gr)])
function [c, ceq] = confun(x)
P = x(1);
W = x(2);
U = x(3);
Wprime = x(4);
Uprime = x(5);
P1 = 1;
P2 = 6;
W1 = 1;
W2 = 5;
U1 = 1;
U2 = 6;
W3 = 10;
U3 = 12;
Cp = 0.05;
c = [-P + P1;
P - P2;
-W + W1;
W - W2;
-U + U1;
U - U2;
-Wprime + W
Wprime - W3
-Uprime + U
Uprime - U3
-ExpUnitProfit+(Cp*P) ];
ceq = [];
end
end
% To run the program, enter the below command:
%
% [history searchdir] = fminconexe2
% reference
% http://www.mathworks.com/help/optim/ug/output-functions.html#brjhnpu
0 Comments
Answers (0)
See Also
Categories
Find more on Surrogate Optimization in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!