What dose this function mean and what is the differentes ?

1 view (last 30 days)
Diyara Rashid
Diyara Rashid on 20 Oct 2021
Commented: DAL on 21 Oct 2021
function u = heuristic0(B)
u = sum(B(:) == 0); %the number of bricks that are zero
end
function u = heuristic1(B)
u = - sum(B(:)); %the negative sum of the values of the bricks
%(remember they are in logarithm, so its not
% the original values being summed)
end
  1 Comment
DAL
DAL on 21 Oct 2021
How would I explain the heuristic function if i combine both of these together?

Sign in to comment.

Answers (1)

Matt J
Matt J on 20 Oct 2021
Edited: Matt J on 20 Oct 2021
The first is calculating the number of zeros in B and the second is summing all values in B (times -1).
  6 Comments

Sign in to comment.

Categories

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!