[770c98]: / Application / Examples / BikeSpring / Model / ObjectivePenal.m

Download this file

16 lines (13 with data), 388 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
% Computes the pseudo-objective function penalized for side constraint
% violations
function [Fps] = ObjectivePenal(xmin,x,xmax)
penalty = 2; % exterior penalty factor
Fps = objective(x);
for j=1:length(x)
if xmin(j) > x(j)
Fps = Fps*(1 + penalty*(xmin(j)-x(j))^2);
end
if x(j) > xmax(j)
Fps = Fps*(1 + penalty*(xmin(j)-x(j))^2);
end
end