Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void
- brtdp_t::trial( hashEntry_t *node )
- {
- double value;
- double b = node->upper()-node->value();
- //std::cout<<b<<std::endl;
- //xxxxx static atomList_t appliedActions;
- std::deque<hashEntry_t*> closed;
- std::deque<hashEntry_t*> Stack;
- //if( gpt::verbosity >= 450 )
- std::cout << "<brtdp>: trial begin:" << std::endl;
- state_t *current = new state_t( *node->state() );
- while( true )
- {
- gpt::visitCount++;
- if( gpt::verbosity >= 450 )
- {
- std::cout << "<brtdp>: node ";
- node->state()->print( std::cout );
- std::cout << " = " << node->value() << std::endl;
- }
- if( (node->value() >= gpt::dead_end_value)){
- std::cout<<node->value()<<"saindo do trial\n\n";
- break;
- }
- if( problem_->goal().holds( *current ) ){
- std::cout<<"saindo do trial 2 \n\n";
- break;
- }
- Stack.push_front( node );
- //xxxxxx int action = hash_table_->bestAction( *current, *problem_, value, &appliedActions );
- int action = hash_table_->bestAction( *current, *problem_, value );
- if( action == -1 )
- {
- node->updateWODif( gpt::dead_end_value );
- node->updateUpper( gpt::dead_end_value );
- break;
- }
- node->updateWODif( value );
- std::cout<<"L: "<<value<<std::endl;
- value = hash_table_->minUpperQ( *node->state(), *problem_);
- node->updateUpper( value );
- std::cout<<"U: "<<value<<std::endl;
- std::cout<<"AAAA\n"<<b;
- //current->print(std::cout);
- int temp = hash_table_->nextStateB( *current, *problem_, action, b); //Escolhe o proximo estado usando dif das heur
- std::cout<<"BBBBBB\n";
- if(temp==2){
- problem_->actionsT()[action]->affect( *current );
- std::cout<<"BBB\n";
- }
- else if (temp){
- std::cout<<"B<b\n";
- break;
- }
- problem_->complete_state( *current );
- node = hash_table_->get( *current );
- assert( current->make_check() );
- //current->print(std::cout);
- if( gpt::verbosity >= 450 )
- {
- std::cout << "<brtdp>: action = ";
- problem_->actionsT()[action]->print( std::cout );
- std::cout << std::endl;
- }
- }
- delete current;
- //xxxxxxx appliedActions.clear();
- //if( gpt::verbosity >= 450 )
- std::cout << "<brtdp>: trial end." << std::endl;
- while( !Stack.empty() )
- {
- node = Stack.front();
- Stack.pop_front();
- value = hash_table_->bestQValue( *node->state(), *problem_ );
- node->updateWODif( value );
- std::cout<<"L: "<<value<<std::endl;
- value = hash_table_->minUpperQ( *node->state(), *problem_);
- node->updateUpper( value );
- std::cout<<"U: "<<value<<std::endl<<"unstack\n";
- }
- std::cout<<"fim\n\n";
- }
Add Comment
Please, Sign In to add comment