Guest User

Untitled

a guest
Jun 24th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.67 KB | None | 0 0
  1. void
  2. brtdp_t::trial( hashEntry_t *node )
  3. {
  4. double value;
  5. double b = node->upper()-node->value();
  6. //std::cout<<b<<std::endl;
  7. //xxxxx static atomList_t appliedActions;
  8. std::deque<hashEntry_t*> closed;
  9. std::deque<hashEntry_t*> Stack;
  10.  
  11. //if( gpt::verbosity >= 450 )
  12. std::cout << "<brtdp>: trial begin:" << std::endl;
  13.  
  14. state_t *current = new state_t( *node->state() );
  15. while( true )
  16. {
  17. gpt::visitCount++;
  18. if( gpt::verbosity >= 450 )
  19. {
  20. std::cout << "<brtdp>: node ";
  21. node->state()->print( std::cout );
  22. std::cout << " = " << node->value() << std::endl;
  23. }
  24.  
  25. if( (node->value() >= gpt::dead_end_value)){
  26. std::cout<<node->value()<<"saindo do trial\n\n";
  27. break;
  28. }
  29.  
  30. if( problem_->goal().holds( *current ) ){
  31. std::cout<<"saindo do trial 2 \n\n";
  32. break;
  33. }
  34.  
  35.  
  36. Stack.push_front( node );
  37. //xxxxxx int action = hash_table_->bestAction( *current, *problem_, value, &appliedActions );
  38.  
  39. int action = hash_table_->bestAction( *current, *problem_, value );
  40. if( action == -1 )
  41. {
  42. node->updateWODif( gpt::dead_end_value );
  43. node->updateUpper( gpt::dead_end_value );
  44. break;
  45. }
  46.  
  47. node->updateWODif( value );
  48. std::cout<<"L: "<<value<<std::endl;
  49. value = hash_table_->minUpperQ( *node->state(), *problem_);
  50. node->updateUpper( value );
  51. std::cout<<"U: "<<value<<std::endl;
  52.  
  53. std::cout<<"AAAA\n"<<b;
  54. //current->print(std::cout);
  55. int temp = hash_table_->nextStateB( *current, *problem_, action, b); //Escolhe o proximo estado usando dif das heur
  56. std::cout<<"BBBBBB\n";
  57. if(temp==2){
  58. problem_->actionsT()[action]->affect( *current );
  59. std::cout<<"BBB\n";
  60. }
  61. else if (temp){
  62. std::cout<<"B<b\n";
  63. break;
  64. }
  65.  
  66. problem_->complete_state( *current );
  67. node = hash_table_->get( *current );
  68. assert( current->make_check() );
  69. //current->print(std::cout);
  70.  
  71. if( gpt::verbosity >= 450 )
  72. {
  73. std::cout << "<brtdp>: action = ";
  74. problem_->actionsT()[action]->print( std::cout );
  75. std::cout << std::endl;
  76. }
  77. }
  78. delete current;
  79. //xxxxxxx appliedActions.clear();
  80.  
  81. //if( gpt::verbosity >= 450 )
  82. std::cout << "<brtdp>: trial end." << std::endl;
  83.  
  84. while( !Stack.empty() )
  85. {
  86. node = Stack.front();
  87. Stack.pop_front();
  88.  
  89. value = hash_table_->bestQValue( *node->state(), *problem_ );
  90. node->updateWODif( value );
  91. std::cout<<"L: "<<value<<std::endl;
  92. value = hash_table_->minUpperQ( *node->state(), *problem_);
  93. node->updateUpper( value );
  94. std::cout<<"U: "<<value<<std::endl<<"unstack\n";
  95.  
  96. }
  97. std::cout<<"fim\n\n";
  98.  
  99. }
Add Comment
Please, Sign In to add comment