Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions oem1.m
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,19 @@
x = round(x);

% Inequality constraints
c = [
sum(x .* cost) - budget; % Total cost should not exceed budget
-sum(x .* infoGain) + minInfoGain; % Total information gain should be at least minInfoGain
-sum(x .* accuracy) / sum(x) + minAvgAccuracy; % Average accuracy should be at least minAvgAccuracy
-sum(x .* mtbf) + minTotalMTBF % Total MTBF should be at least minTotalMTBF
];
totalSelected = sum(x);
if totalSelected > 0
avgAccuracy = sum(x .* accuracy) / totalSelected;
else
avgAccuracy = 0; % Avoid division by zero when no sensors selected
end

c = [
sum(x .* cost) - budget; % Total cost should not exceed budget
-sum(x .* infoGain) + minInfoGain; % Total information gain should be at least minInfoGain
-avgAccuracy + minAvgAccuracy; % Average accuracy should be at least minAvgAccuracy
-sum(x .* mtbf) + minTotalMTBF % Total MTBF should be at least minTotalMTBF
];

% Equality constraint: Exactly 2 sensors should be selected
ceq = sum(x) - 2;
Expand Down