<jupyter_start><jupyter_text>Breadth-first search for STRIPS domain defined in Planning Algorithms<jupyter_code>%load_ext autoreload
%autoreload 2

import matplotlib.pyplot as plt
%matplotlib inline

import numpy as np
from strips import STRIPS, Node, Queue, get_plan
strip = STRIPS()
n0 = Node(strip)
qq = Queue()
qq.queue(n0)

operators = ['place_cap', 'remove_cap', 'insert_0', 'insert_1']
max_depth = 5
while not qq.is_empty():
    if all([node.depth >= max_depth for node in qq.list]):
        print('Max depth violated')
        break

    leaf_node = qq.dequeue()
    for operator in operators:
        new_leaf = leaf_node.act(operator)
        qq.queue(new_leaf)

    if any([node.solved for node in qq.list]):
        print('solved')
        break
solved_node = [node for node in qq.list if node.solved][0]
plan = get_plan(solved_node)
plan<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10795454545454546, 'fraction_numerical': 0.007954545454545454, 'mean_word_length': 3.977401129943503, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '315985', 'license': 'MIT', 'n_tokens_mistral': 317, 'n_tokens_neox': 308, 'n_words': 85, 'path': 'misc/strips.ipynb', 'repo_name': 'acauligi/astrobee-tamp', 'size': '880'}