diff options
author | Michael Abed <michaelabed@gmail.com> | 2012-04-07 23:14:54 -0400 |
---|---|---|
committer | Michael Abed <michaelabed@gmail.com> | 2012-04-07 23:14:54 -0400 |
commit | 81117fb87ae3edb8b7bb31962f52b8c85af431fa (patch) | |
tree | e5d824ffec9bc86ba94532b3fb7ff3e4225ca09a /computeTrussCost.m | |
parent | 2ad700f049fc8b62c33eab73c641cf67e81effbc (diff) | |
download | ek301-prelim-81117fb87ae3edb8b7bb31962f52b8c85af431fa.tar.gz ek301-prelim-81117fb87ae3edb8b7bb31962f52b8c85af431fa.tar.bz2 ek301-prelim-81117fb87ae3edb8b7bb31962f52b8c85af431fa.zip |
update
Diffstat (limited to 'computeTrussCost.m')
-rwxr-xr-x | computeTrussCost.m | 16 |
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 |