Skip to content

Commit f907b99

Browse files
committed
fixing bugs. case 5 runs. hits infinite loop
1 parent e35f696 commit f907b99

File tree

6 files changed

+28
-64
lines changed

6 files changed

+28
-64
lines changed

src/deadend.cc

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -117,21 +117,21 @@ void update_deadends(vector< DeadendTuple* > &failed_states) {
117117

118118
////////////////////////////////////////////
119119

120-
// Check to see if we have any consistent "all-fire" operators
121-
reg_items.clear();
122-
PR2.general.regressable_cond_ops->generate_consistent_items(*failed_state,
123-
reg_items,
124-
PR2.deadend.regress_trigger_only);
120+
// // Check to see if we have any consistent "all-fire" operators
121+
// reg_items.clear();
122+
// PR2.general.regressable_cond_ops->generate_consistent_items(*failed_state,
123+
// reg_items,
124+
// PR2.deadend.regress_trigger_only);
125125

126-
// For each operator, create a new deadend avoidance pair
127-
for (auto item : reg_items) {
126+
// // For each operator, create a new deadend avoidance pair
127+
// for (auto item : reg_items) {
128128

129-
RegressableOperator *ro = (RegressableOperator*)item;
129+
// RegressableOperator *ro = (RegressableOperator*)item;
130130

131-
fsaps.push_back(new FSAP(failed_state->regress(ro->op, ro->op.all_fire_context),
132-
ro->op));
131+
// fsaps.push_back(new FSAP(failed_state->regress(ro->op, ro->op.all_fire_context),
132+
// ro->op));
133133

134-
}
134+
// }
135135

136136
////////////////////////////////////////////
137137

src/fd_integration/partial_state.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ PR2State::PR2State(std::vector<int> init_vals) {
2626
}
2727

2828
PR2State::PR2State(const State &state) {
29-
// _allocate();
29+
_allocate(PR2.general.num_vars);
3030
for (auto var : state)
3131
vars[var.get_variable().get_id()] = var.get_value();
3232
}

src/fd_integration/partial_state.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@ class StateInterface;
1515
class PR2State : public StateInterface {
1616
std::vector<int> vars; // values for vars
1717
std::vector< std::pair<int,int> > * _varvals = NULL; // varval pairs for partial states
18-
// void _allocate();
19-
// void _deallocate();
18+
void _allocate(int size) {
19+
vars.reserve(size);
20+
}
21+
void _deallocate() {}
2022
// void _copy_buffer_from_state(const PR2State &state);
2123

2224
public:

src/fd_integration/pr2_search_algorithm.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ unique_ptr<SearchAlgorithm> PR2Search::get_search_engine() {
6767
numeric_limits<double>::infinity(),
6868
"PR2 Search",
6969
utils::Verbosity::SILENT,
70-
weak_task,
70+
tasks::g_root_task,
7171
new DeadendAwareSuccessorGenerator());
7272

7373
return unique_ptr<SearchAlgorithm>(engine);

src/pr2.cc

Lines changed: 3 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,9 @@ void PR2Wrapper::generate_nondet_operator_mappings() {
273273

274274
for (auto op : PR2.proxy->get_operators()) {
275275
//If not in the mapping yet
276+
PR2.general.conditional_mask.push_back(new vector<int>());
277+
PR2.deadend.nondetop2fsaps.push_back(new vector< FSAP* >());
278+
276279
if (nondet_name_to_index.find(op.get_nondet_name()) == nondet_name_to_index.end()) {
277280
nondet_name_to_index[op.get_nondet_name()] = current_nondet_index;
278281
PR2.general.nondet_mapping.push_back(vector<int>());
@@ -306,50 +309,6 @@ void PR2Wrapper::generate_nondet_operator_mappings() {
306309
}
307310

308311
PR2.proxy->set_nondet_index_map(*nondet_index_map);
309-
310-
//TODO
311-
//Reinstantiate conditional mask and possibly nondetop2fspas
312-
//They were previously global and not instantiated anywhere
313-
314-
315-
// /* Build the data structures required for mapping between the
316-
// * deterministic actions and their non-deterministic equivalents. */
317-
// int cur_nondet = 0;
318-
// for (auto op : PR2.proxy->get_operators()) {
319-
320-
// int nondet_index = -1;
321-
322-
// PR2.general.conditional_mask.push_back(new vector<int>());
323-
// PR2.deadend.nondetop2fsaps.push_back(new vector< FSAP* >());
324-
325-
// if (PRP.general.nondet_index_mapping.find(op.get_nondet_name()) == PRP.general.nondet_index_mapping.end()) {
326-
327-
// nondet_index = cur_nondet;
328-
// PRP.general.nondet_index_mapping[op.get_nondet_name()] = cur_nondet;
329-
330-
// PRP.general.nondet_mapping.push_back(new vector<GlobalOperator *>());
331-
// PRP.general.conditional_mask.push_back(new vector<int>());
332-
333-
// PRP.deadend.nondetop2fsaps.push_back(new vector< FSAP* >());
334-
335-
// cur_nondet++;
336-
337-
// } else {
338-
// nondet_index = PRP.general.nondet_index_mapping[op.get_nondet_name()];
339-
// }
340-
341-
// op.nondet_index = nondet_index;
342-
// PRP.general.nondet_mapping[nondet_index]->push_back(&op);
343-
// op.nondet_outcome = PRP.general.nondet_mapping[nondet_index]->size() - 1;
344-
345-
// for (auto eff : op.get_all_effects()) {
346-
// for (auto cond : eff.conditions) {
347-
// vector<int> *var_list = PRP.general.conditional_mask[nondet_index];
348-
// if (find(var_list->begin(), var_list->end(), cond.var) == var_list->end())
349-
// PRP.general.conditional_mask[nondet_index]->push_back(cond.var);
350-
// }
351-
// }
352-
// }
353312
}
354313

355314
void PR2OperatorProxy::update_nondet_info() {

src/simulator.cc

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -193,19 +193,22 @@ bool Simulator::check_1safe() {
193193
if (PR2.deadend.force_1safe_weak_plans)
194194
safe_checks = engine->get_plan().size();
195195

196+
PR2OperatorsProxy ops = PR2.proxy->get_operators();
196197
for (unsigned i = 0; i < safe_checks; i++) {
197-
const PR2OperatorProxy op = PR2.proxy->get_operators()[engine->get_plan()[i]];
198+
const PR2OperatorProxy op = ops[engine->get_plan()[i]];
199+
PR2OperatorProxy *op_stable = new PR2OperatorProxy(op);
198200
vector<NondetSuccessor *> successors;
199-
new_s = generate_nondet_successors(old_s, &op, successors);
201+
new_s = generate_nondet_successors(old_s, op_stable, successors);
200202

201203
for (auto succ : successors) {
202204
if (is_deadend(*(succ->state))) {
203205
PR2State * new_dead_state = new PR2State(*(succ->state));
204-
int op_ind = PR2.general.nondet_mapping[op.nondet_index][succ->id];
205-
const PR2OperatorProxy bad_op = PR2.proxy->get_operators()[op_ind];
206+
int op_ind = PR2.general.nondet_mapping[op_stable->nondet_index][succ->id - 1];
207+
const PR2OperatorProxy bad_op = ops[op_ind];
208+
PR2OperatorProxy *bad_op_stable = new PR2OperatorProxy(bad_op);
206209
if (PR2.deadend.generalize)
207210
generalize_deadend(*new_dead_state);
208-
new_deadends.push_back(new DeadendTuple(new_dead_state, new PR2State(*old_s), &bad_op));
211+
new_deadends.push_back(new DeadendTuple(new_dead_state, new PR2State(*old_s), bad_op_stable));
209212
}
210213
}
211214

0 commit comments

Comments
 (0)