summaryrefslogtreecommitdiff
path: root/computeTrussCost.m
diff options
context:
space:
mode:
authorMichael Abed <michaelabed@gmail.com>2012-04-07 23:14:54 -0400
committerMichael Abed <michaelabed@gmail.com>2012-04-07 23:14:54 -0400
commit81117fb87ae3edb8b7bb31962f52b8c85af431fa (patch)
treee5d824ffec9bc86ba94532b3fb7ff3e4225ca09a /computeTrussCost.m
parent2ad700f049fc8b62c33eab73c641cf67e81effbc (diff)
downloadek301-prelim-81117fb87ae3edb8b7bb31962f52b8c85af431fa.tar.gz
ek301-prelim-81117fb87ae3edb8b7bb31962f52b8c85af431fa.tar.bz2
ek301-prelim-81117fb87ae3edb8b7bb31962f52b8c85af431fa.zip
update
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