سلام کسی میدونه روش پیاده سازی جست و جوی پرتویی یا همون beam search در متلب چه جوریه ؟
لطفا راهنمایی کنید و اگه سورس هم دارید برام بفرستید تشکر




homayonisaeed@gmail.com
https://fa.wikipedia.org/wiki/%D8%A7...AD%D9%84%DB%8C

/* initialization */

g = 0;

hash_table = { start };

BEAM = { start };

/* main loop */

while(BEAM ≠ ∅){ // loop until the BEAM contains no nodes

SET = ∅; // the empty set

/* generate the SET nodes */
for(each state in BEAM){
for(each successor of state){
if(successor == goal) return g + 1;
SET = SET ∪ { successor }; // add successor to SET
}
}

BEAM = ∅; // the empty set
g = g + 1;

/* fill the BEAM for the next loop */
while((SET ≠ ∅) AND (B> |BEAM|)){ // set is not empty and the number of nodes in BEAM is less than B
state = successor in SET with smallest h value;
SET = SET \ { state }; // remove state from SET
if(state ∉ hash_table){ // state is not in the hash_table
if(hash_table is full) return ∞;
hash_table = hash_table ∪ { state }; // add state to hash_table
BEAM = BEAM ∪ { state }; // add state to BEAM
}
}
}