What dose this function mean and what is the differentes ?

2 views (last 30 days)
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
Matt J
Matt J on 21 Oct 2021
That's -N wher N is the number of B(i) that equal 1.

Sign in to comment.

Categories

Find more on Card games in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!