What dose this function mean and what is the differentes ?

1 visualizzazione (ultimi 30 giorni)
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 Commento
DAL
DAL il 21 Ott 2021
How would I explain the heuristic function if i combine both of these together?

Accedi per commentare.

Risposte (1)

Matt J
Matt J il 20 Ott 2021
Modificato: Matt J il 20 Ott 2021
The first is calculating the number of zeros in B and the second is summing all values in B (times -1).
  6 Commenti
Matt J
Matt J il 21 Ott 2021
That's -N wher N is the number of B(i) that equal 1.

Accedi per commentare.

Categorie

Scopri di più su Card games in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by