summaryrefslogtreecommitdiff
path: root/computeTrussCost.m
diff options
context:
space:
mode:
Diffstat (limited to 'computeTrussCost.m')
-rwxr-xr-xcomputeTrussCost.m16
1 files changed, 3 insertions, 13 deletions
diff --git a/computeTrussCost.m b/computeTrussCost.m
index df7daad..e3fed5d 100755
--- a/computeTrussCost.m
+++ b/computeTrussCost.m
@@ -1,15 +1,5 @@
-function [ cost ] = computeTrussCost( C, X, Y )
+function [ cost ] = computeTrussCost( C, D )
cost = 0;
- [ j, m ] = size(C);
- cost = cost + 10*j;
- for i = 1:m
- memb = C(:,i);
- points = [X(memb == 1); Y(memb == 1)];
- d = dist(points(:,1), points(:,2));
- cost = cost + d;
- end
+ [ j, ~ ] = size(C);
+ cost = cost + 10*j + sum(D);
end
-
-function [ d ] = dist(p1, p2)
- d = sqrt((p1(1)-p2(1))^2+(p1(2)-p2(2))^2);
-end \ No newline at end of file