From 32991e209fc5e39a9a6c1dd053514d8f00c67df0 Mon Sep 17 00:00:00 2001 From: Dominik Drexler Date: Sat, 2 Mar 2024 16:37:20 +0100 Subject: [PATCH] readded tuple indices for tuple graph of width 0 --- setup.py | 2 +- src/novelty/tuple_graph.cpp | 8 +++----- src/novelty/tuple_graph_builder.cpp | 6 +++--- tests/novelty/gripper/gripper.cpp | 28 +++------------------------- 4 files changed, 10 insertions(+), 34 deletions(-) diff --git a/setup.py b/setup.py index d7e2d672..cccbb9ba 100644 --- a/setup.py +++ b/setup.py @@ -9,7 +9,7 @@ from setuptools import setup, find_packages, Extension from setuptools.command.build_ext import build_ext -__version__ = "0.3.17" +__version__ = "0.3.18" HERE = Path(__file__).resolve().parent diff --git a/src/novelty/tuple_graph.cpp b/src/novelty/tuple_graph.cpp index b64f2384..1d0e992d 100644 --- a/src/novelty/tuple_graph.cpp +++ b/src/novelty/tuple_graph.cpp @@ -43,14 +43,12 @@ TupleGraph& TupleGraph::operator=(TupleGraph&& other) = default; TupleGraph::~TupleGraph() = default; std::string TupleGraph::compute_repr() const { - // Step 1: Sort nodes, compute index remapping + // Step 1: Sort tuple nodes by tuple index, compute index remapping TupleNodes nodes = m_nodes; std::sort(nodes.begin(), nodes.end(), [](const TupleNode& l, const TupleNode& r){ - if (l.get_state_indices() == r.get_state_indices()) { - return l.get_tuple_index() < r.get_tuple_index(); - } - return l.get_state_indices() < r.get_state_indices(); + return l.get_tuple_index() < r.get_tuple_index(); }); + // Remap node indices to get a canonical representation std::vector remapping(nodes.size()); for (size_t i = 0; i < nodes.size(); ++i) { remapping[nodes[i].get_index()] = i; // old to new index diff --git a/src/novelty/tuple_graph_builder.cpp b/src/novelty/tuple_graph_builder.cpp index 38233f50..feee9410 100644 --- a/src/novelty/tuple_graph_builder.cpp +++ b/src/novelty/tuple_graph_builder.cpp @@ -119,9 +119,8 @@ bool TupleGraphBuilder::test_prune(const std::vector& tuple_node_laye void TupleGraphBuilder::build_width_equal_0_tuple_graph() { TupleNodeIndex initial_node_index = m_nodes.size(); - TupleIndex tuple_index = m_novelty_base->atom_indices_to_tuple_index({}); m_node_indices_by_distance.push_back({initial_node_index}); - m_nodes.push_back({TupleNode(initial_node_index, tuple_index, {m_root_state_index})}); + m_nodes.push_back({TupleNode(initial_node_index, initial_node_index, {m_root_state_index})}); m_state_indices_by_distance.push_back({m_root_state_index}); const auto& it = m_state_space->get_forward_successor_state_indices().find(m_root_state_index); if (it != m_state_space->get_forward_successor_state_indices().end()) { @@ -130,7 +129,8 @@ void TupleGraphBuilder::build_width_equal_0_tuple_graph() { for (const auto& target_index : it->second) { TupleNodeIndex node_index = m_nodes.size(); curr_tuple_layer.push_back(node_index); - auto tuple_node = TupleNode(node_index, tuple_index, {target_index}); + auto tuple_node = TupleNode(node_index, node_index, {target_index}); + std::cout << node_index << std::endl; m_nodes.push_back(tuple_node); m_nodes[initial_node_index].add_successor(node_index); m_nodes[node_index].add_predecessor(initial_node_index); diff --git a/tests/novelty/gripper/gripper.cpp b/tests/novelty/gripper/gripper.cpp index 7eac8214..0c102950 100644 --- a/tests/novelty/gripper/gripper.cpp +++ b/tests/novelty/gripper/gripper.cpp @@ -19,36 +19,14 @@ TEST(DLPTests, NoveltyGripperTest) { auto novelty_base_0 = std::make_shared( state_space->get_instance_info()->get_atoms().size(), 0); - EXPECT_EQ(TupleGraph(novelty_base_0, state_space, 0).compute_repr(), "TupleGraph(\n root_state_index=0,\n tuple_nodes=[ TupleNode(index=0, tuple_index=0, state_indices={0}, predecessors=[], successors=[1, 2, 3]),\n TupleNode(index=1, tuple_index=0, state_indices={1}, predecessors=[0], successors=[]),\n TupleNode(index=2, tuple_index=0, state_indices={2}, predecessors=[0], successors=[]),\n TupleNode(index=3, tuple_index=0, state_indices={3}, predecessors=[0], successors=[])\n ],\n node_indices_by_distance=[\n [0],\n [1, 2, 3]\n ],\n state_indices_by_distance=[\n [0],\n [1, 2, 3]\n ]\n)"); - EXPECT_EQ(TupleGraph(novelty_base_0, state_space, 1).compute_repr(), "TupleGraph(\n root_state_index=1,\n tuple_nodes=[ TupleNode(index=0, tuple_index=0, state_indices={0}, predecessors=[1], successors=[]),\n TupleNode(index=1, tuple_index=0, state_indices={1}, predecessors=[], successors=[0])\n ],\n node_indices_by_distance=[\n [1],\n [0]\n ],\n state_indices_by_distance=[\n [1],\n [0]\n ]\n)"); - EXPECT_EQ(TupleGraph(novelty_base_0, state_space, 2).compute_repr(), "TupleGraph(\n root_state_index=2,\n tuple_nodes=[ TupleNode(index=0, tuple_index=0, state_indices={0}, predecessors=[1], successors=[]),\n TupleNode(index=1, tuple_index=0, state_indices={2}, predecessors=[], successors=[0, 2]),\n TupleNode(index=2, tuple_index=0, state_indices={4}, predecessors=[1], successors=[])\n ],\n node_indices_by_distance=[\n [1],\n [0, 2]\n ],\n state_indices_by_distance=[\n [2],\n [0, 4]\n ]\n)"); - EXPECT_EQ(TupleGraph(novelty_base_0, state_space, 3).compute_repr(), "TupleGraph(\n root_state_index=3,\n tuple_nodes=[ TupleNode(index=0, tuple_index=0, state_indices={0}, predecessors=[1], successors=[]),\n TupleNode(index=1, tuple_index=0, state_indices={3}, predecessors=[], successors=[0, 2]),\n TupleNode(index=2, tuple_index=0, state_indices={5}, predecessors=[1], successors=[])\n ],\n node_indices_by_distance=[\n [1],\n [0, 2]\n ],\n state_indices_by_distance=[\n [3],\n [0, 5]\n ]\n)"); - EXPECT_EQ(TupleGraph(novelty_base_0, state_space, 4).compute_repr(), "TupleGraph(\n root_state_index=4,\n tuple_nodes=[ TupleNode(index=0, tuple_index=0, state_indices={2}, predecessors=[1], successors=[]),\n TupleNode(index=1, tuple_index=0, state_indices={4}, predecessors=[], successors=[0, 2]),\n TupleNode(index=2, tuple_index=0, state_indices={6}, predecessors=[1], successors=[])\n ],\n node_indices_by_distance=[\n [1],\n [0, 2]\n ],\n state_indices_by_distance=[\n [4],\n [2, 6]\n ]\n)"); - EXPECT_EQ(TupleGraph(novelty_base_0, state_space, 5).compute_repr(), "TupleGraph(\n root_state_index=5,\n tuple_nodes=[ TupleNode(index=0, tuple_index=0, state_indices={3}, predecessors=[1], successors=[]),\n TupleNode(index=1, tuple_index=0, state_indices={5}, predecessors=[], successors=[0, 2]),\n TupleNode(index=2, tuple_index=0, state_indices={6}, predecessors=[1], successors=[])\n ],\n node_indices_by_distance=[\n [1],\n [0, 2]\n ],\n state_indices_by_distance=[\n [5],\n [3, 6]\n ]\n)"); - EXPECT_EQ(TupleGraph(novelty_base_0, state_space, 6).compute_repr(), "TupleGraph(\n root_state_index=6,\n tuple_nodes=[ TupleNode(index=0, tuple_index=0, state_indices={4}, predecessors=[2], successors=[]),\n TupleNode(index=1, tuple_index=0, state_indices={5}, predecessors=[2], successors=[]),\n TupleNode(index=2, tuple_index=0, state_indices={6}, predecessors=[], successors=[0, 1, 3]),\n TupleNode(index=3, tuple_index=0, state_indices={7}, predecessors=[2], successors=[])\n ],\n node_indices_by_distance=[\n [2],\n [0, 1, 3]\n ],\n state_indices_by_distance=[\n [6],\n [4, 5, 7]\n ]\n)"); - EXPECT_EQ(TupleGraph(novelty_base_0, state_space, 7).compute_repr(), "TupleGraph(\n root_state_index=7,\n tuple_nodes=[ TupleNode(index=0, tuple_index=0, state_indices={6}, predecessors=[1], successors=[]),\n TupleNode(index=1, tuple_index=0, state_indices={7}, predecessors=[], successors=[0])\n ],\n node_indices_by_distance=[\n [1],\n [0]\n ],\n state_indices_by_distance=[\n [7],\n [6]\n ]\n)"); + EXPECT_EQ(TupleGraph(novelty_base_0, state_space, 0, false).compute_repr(), "TupleGraph(\n root_state_index=0,\n tuple_nodes=[ TupleNode(index=0, tuple_index=0, state_indices={0}, predecessors=[], successors=[1, 2, 3]),\n TupleNode(index=1, tuple_index=1, state_indices={3}, predecessors=[0], successors=[]),\n TupleNode(index=2, tuple_index=2, state_indices={2}, predecessors=[0], successors=[]),\n TupleNode(index=3, tuple_index=3, state_indices={1}, predecessors=[0], successors=[])\n ],\n node_indices_by_distance=[\n [0],\n [1, 2, 3]\n ],\n state_indices_by_distance=[\n [0],\n [1, 2, 3]\n ]\n)"); + EXPECT_EQ(TupleGraph(novelty_base_0, state_space, 0, true).compute_repr(), "TupleGraph(\n root_state_index=0,\n tuple_nodes=[ TupleNode(index=0, tuple_index=0, state_indices={0}, predecessors=[], successors=[1, 2, 3]),\n TupleNode(index=1, tuple_index=1, state_indices={3}, predecessors=[0], successors=[]),\n TupleNode(index=2, tuple_index=2, state_indices={2}, predecessors=[0], successors=[]),\n TupleNode(index=3, tuple_index=3, state_indices={1}, predecessors=[0], successors=[])\n ],\n node_indices_by_distance=[\n [0],\n [1, 2, 3]\n ],\n state_indices_by_distance=[\n [0],\n [1, 2, 3]\n ]\n)"); auto novelty_base_1 = std::make_shared( state_space->get_instance_info()->get_atoms().size(), 1); - - EXPECT_EQ(TupleGraph(novelty_base_1, state_space, 0, false).compute_repr(), "TupleGraph(\n root_state_index=0,\n tuple_nodes=[ TupleNode(index=0, tuple_index=0, state_indices={0}, predecessors=[], successors=[5, 6, 7]),\n TupleNode(index=1, tuple_index=1, state_indices={0}, predecessors=[], successors=[5, 6, 7]),\n TupleNode(index=2, tuple_index=3, state_indices={0}, predecessors=[], successors=[5, 6, 7]),\n TupleNode(index=3, tuple_index=4, state_indices={0}, predecessors=[], successors=[5, 6, 7]),\n TupleNode(index=4, tuple_index=5, state_indices={0}, predecessors=[], successors=[5, 6, 7]),\n TupleNode(index=5, tuple_index=2, state_indices={1}, predecessors=[0, 1, 2, 3, 4], successors=[]),\n TupleNode(index=6, tuple_index=7, state_indices={2}, predecessors=[0, 1, 2, 3, 4], successors=[]),\n TupleNode(index=7, tuple_index=8, state_indices={3}, predecessors=[0, 1, 2, 3, 4], successors=[])\n ],\n node_indices_by_distance=[\n [0, 1, 2, 3, 4],\n [5, 6, 7]\n ],\n state_indices_by_distance=[\n [0],\n [1, 2, 3]\n ]\n)"); - EXPECT_EQ(TupleGraph(novelty_base_1, state_space, 1, false).compute_repr(), "TupleGraph(\n root_state_index=1,\n tuple_nodes=[ TupleNode(index=0, tuple_index=1, state_indices={0}, predecessors=[1, 2, 3, 4, 5], successors=[6, 7]),\n TupleNode(index=1, tuple_index=0, state_indices={1}, predecessors=[], successors=[0]),\n TupleNode(index=2, tuple_index=2, state_indices={1}, predecessors=[], successors=[0]),\n TupleNode(index=3, tuple_index=3, state_indices={1}, predecessors=[], successors=[0]),\n TupleNode(index=4, tuple_index=4, state_indices={1}, predecessors=[], successors=[0]),\n TupleNode(index=5, tuple_index=5, state_indices={1}, predecessors=[], successors=[0]),\n TupleNode(index=6, tuple_index=7, state_indices={2}, predecessors=[0], successors=[]),\n TupleNode(index=7, tuple_index=8, state_indices={3}, predecessors=[0], successors=[])\n ],\n node_indices_by_distance=[\n [1, 2, 3, 4, 5],\n [0],\n [6, 7]\n ],\n state_indices_by_distance=[\n [1],\n [0],\n [2, 3]\n ]\n)"); - EXPECT_EQ(TupleGraph(novelty_base_1, state_space, 2, false).compute_repr(), "TupleGraph(\n root_state_index=2,\n tuple_nodes=[ TupleNode(index=0, tuple_index=3, state_indices={0}, predecessors=[2, 3, 4, 5], successors=[6]),\n TupleNode(index=1, tuple_index=5, state_indices={0}, predecessors=[2, 3, 4, 5], successors=[6]),\n TupleNode(index=2, tuple_index=0, state_indices={2}, predecessors=[], successors=[0, 1, 7]),\n TupleNode(index=3, tuple_index=1, state_indices={2}, predecessors=[], successors=[0, 1, 7]),\n TupleNode(index=4, tuple_index=4, state_indices={2}, predecessors=[], successors=[0, 1, 7]),\n TupleNode(index=5, tuple_index=7, state_indices={2}, predecessors=[], successors=[0, 1, 7]),\n TupleNode(index=6, tuple_index=8, state_indices={3}, predecessors=[0, 1], successors=[]),\n TupleNode(index=7, tuple_index=2, state_indices={4}, predecessors=[2, 3, 4, 5], successors=[8]),\n TupleNode(index=8, tuple_index=6, state_indices={6}, predecessors=[7], successors=[])\n ],\n node_indices_by_distance=[\n [2, 3, 4, 5],\n [0, 1, 7],\n [6, 8]\n ],\n state_indices_by_distance=[\n [2],\n [0, 4],\n [1, 3, 6]\n ]\n)"); - EXPECT_EQ(TupleGraph(novelty_base_1, state_space, 3, false).compute_repr(), "TupleGraph(\n root_state_index=3,\n tuple_nodes=[ TupleNode(index=0, tuple_index=4, state_indices={0}, predecessors=[3, 4, 5, 6], successors=[2]),\n TupleNode(index=1, tuple_index=5, state_indices={0}, predecessors=[3, 4, 5, 6], successors=[2]),\n TupleNode(index=2, tuple_index=7, state_indices={2}, predecessors=[0, 1], successors=[]),\n TupleNode(index=3, tuple_index=0, state_indices={3}, predecessors=[], successors=[0, 1, 7]),\n TupleNode(index=4, tuple_index=1, state_indices={3}, predecessors=[], successors=[0, 1, 7]),\n TupleNode(index=5, tuple_index=3, state_indices={3}, predecessors=[], successors=[0, 1, 7]),\n TupleNode(index=6, tuple_index=8, state_indices={3}, predecessors=[], successors=[0, 1, 7]),\n TupleNode(index=7, tuple_index=2, state_indices={5}, predecessors=[3, 4, 5, 6], successors=[8]),\n TupleNode(index=8, tuple_index=6, state_indices={6}, predecessors=[7], successors=[])\n ],\n node_indices_by_distance=[\n [3, 4, 5, 6],\n [0, 1, 7],\n [2, 8]\n ],\n state_indices_by_distance=[\n [3],\n [0, 5],\n [1, 2, 6]\n ]\n)"); - EXPECT_EQ(TupleGraph(novelty_base_1, state_space, 4, false).compute_repr(), "TupleGraph(\n root_state_index=4,\n tuple_nodes=[ TupleNode(index=0, tuple_index=5, state_indices={0}, predecessors=[1], successors=[]),\n TupleNode(index=1, tuple_index=1, state_indices={2}, predecessors=[2, 3, 4, 5], successors=[0]),\n TupleNode(index=2, tuple_index=0, state_indices={4}, predecessors=[], successors=[1, 7, 8]),\n TupleNode(index=3, tuple_index=2, state_indices={4}, predecessors=[], successors=[1, 7, 8]),\n TupleNode(index=4, tuple_index=4, state_indices={4}, predecessors=[], successors=[1, 7, 8]),\n TupleNode(index=5, tuple_index=7, state_indices={4}, predecessors=[], successors=[1, 7, 8]),\n TupleNode(index=6, tuple_index=8, state_indices={5}, predecessors=[7, 8], successors=[]),\n TupleNode(index=7, tuple_index=3, state_indices={6}, predecessors=[2, 3, 4, 5], successors=[6]),\n TupleNode(index=8, tuple_index=6, state_indices={6}, predecessors=[2, 3, 4, 5], successors=[6])\n ],\n node_indices_by_distance=[\n [2, 3, 4, 5],\n [1, 7, 8],\n [0, 6]\n ],\n state_indices_by_distance=[\n [4],\n [2, 6],\n [0, 5, 7]\n ]\n)"); - EXPECT_EQ(TupleGraph(novelty_base_1, state_space, 5, false).compute_repr(), "TupleGraph(\n root_state_index=5,\n tuple_nodes=[ TupleNode(index=0, tuple_index=5, state_indices={0}, predecessors=[1], successors=[]),\n TupleNode(index=1, tuple_index=1, state_indices={3}, predecessors=[3, 4, 5, 6], successors=[0]),\n TupleNode(index=2, tuple_index=7, state_indices={4}, predecessors=[7, 8], successors=[]),\n TupleNode(index=3, tuple_index=0, state_indices={5}, predecessors=[], successors=[1, 7, 8]),\n TupleNode(index=4, tuple_index=2, state_indices={5}, predecessors=[], successors=[1, 7, 8]),\n TupleNode(index=5, tuple_index=3, state_indices={5}, predecessors=[], successors=[1, 7, 8]),\n TupleNode(index=6, tuple_index=8, state_indices={5}, predecessors=[], successors=[1, 7, 8]),\n TupleNode(index=7, tuple_index=4, state_indices={6}, predecessors=[3, 4, 5, 6], successors=[2]),\n TupleNode(index=8, tuple_index=6, state_indices={6}, predecessors=[3, 4, 5, 6], successors=[2])\n ],\n node_indices_by_distance=[\n [3, 4, 5, 6],\n [1, 7, 8],\n [0, 2]\n ],\n state_indices_by_distance=[\n [5],\n [3, 6],\n [0, 4, 7]\n ]\n)"); - EXPECT_EQ(TupleGraph(novelty_base_1, state_space, 6, false).compute_repr(), "TupleGraph(\n root_state_index=6,\n tuple_nodes=[ TupleNode(index=0, tuple_index=7, state_indices={4}, predecessors=[2, 3, 4, 5, 6], successors=[]),\n TupleNode(index=1, tuple_index=8, state_indices={5}, predecessors=[2, 3, 4, 5, 6], successors=[]),\n TupleNode(index=2, tuple_index=0, state_indices={6}, predecessors=[], successors=[0, 1, 7]),\n TupleNode(index=3, tuple_index=2, state_indices={6}, predecessors=[], successors=[0, 1, 7]),\n TupleNode(index=4, tuple_index=3, state_indices={6}, predecessors=[], successors=[0, 1, 7]),\n TupleNode(index=5, tuple_index=4, state_indices={6}, predecessors=[], successors=[0, 1, 7]),\n TupleNode(index=6, tuple_index=6, state_indices={6}, predecessors=[], successors=[0, 1, 7]),\n TupleNode(index=7, tuple_index=1, state_indices={7}, predecessors=[2, 3, 4, 5, 6], successors=[])\n ],\n node_indices_by_distance=[\n [2, 3, 4, 5, 6],\n [0, 1, 7]\n ],\n state_indices_by_distance=[\n [6],\n [4, 5, 7]\n ]\n)"); - EXPECT_EQ(TupleGraph(novelty_base_1, state_space, 7, false).compute_repr(), "TupleGraph(\n root_state_index=7,\n tuple_nodes=[ TupleNode(index=0, tuple_index=7, state_indices={4}, predecessors=[2], successors=[]),\n TupleNode(index=1, tuple_index=8, state_indices={5}, predecessors=[2], successors=[]),\n TupleNode(index=2, tuple_index=2, state_indices={6}, predecessors=[3, 4, 5, 6, 7], successors=[0, 1]),\n TupleNode(index=3, tuple_index=0, state_indices={7}, predecessors=[], successors=[2]),\n TupleNode(index=4, tuple_index=1, state_indices={7}, predecessors=[], successors=[2]),\n TupleNode(index=5, tuple_index=3, state_indices={7}, predecessors=[], successors=[2]),\n TupleNode(index=6, tuple_index=4, state_indices={7}, predecessors=[], successors=[2]),\n TupleNode(index=7, tuple_index=6, state_indices={7}, predecessors=[], successors=[2])\n ],\n node_indices_by_distance=[\n [3, 4, 5, 6, 7],\n [2],\n [0, 1]\n ],\n state_indices_by_distance=[\n [7],\n [6],\n [4, 5]\n ]\n)"); - + EXPECT_EQ(TupleGraph(novelty_base_1, state_space, 0, false).compute_repr(), "TupleGraph(\n root_state_index=0,\n tuple_nodes=[ TupleNode(index=0, tuple_index=0, state_indices={0}, predecessors=[], successors=[2, 6, 7]),\n TupleNode(index=1, tuple_index=1, state_indices={0}, predecessors=[], successors=[2, 6, 7]),\n TupleNode(index=2, tuple_index=2, state_indices={1}, predecessors=[0, 1, 3, 4, 5], successors=[]),\n TupleNode(index=3, tuple_index=3, state_indices={0}, predecessors=[], successors=[2, 6, 7]),\n TupleNode(index=4, tuple_index=4, state_indices={0}, predecessors=[], successors=[2, 6, 7]),\n TupleNode(index=5, tuple_index=5, state_indices={0}, predecessors=[], successors=[2, 6, 7]),\n TupleNode(index=6, tuple_index=7, state_indices={2}, predecessors=[0, 1, 3, 4, 5], successors=[]),\n TupleNode(index=7, tuple_index=8, state_indices={3}, predecessors=[0, 1, 3, 4, 5], successors=[])\n ],\n node_indices_by_distance=[\n [0, 1, 3, 4, 5],\n [2, 6, 7]\n ],\n state_indices_by_distance=[\n [0],\n [1, 2, 3]\n ]\n)"); EXPECT_EQ(TupleGraph(novelty_base_1, state_space, 0, true).compute_repr(), "TupleGraph(\n root_state_index=0,\n tuple_nodes=[ TupleNode(index=0, tuple_index=0, state_indices={0}, predecessors=[], successors=[1, 2, 3]),\n TupleNode(index=1, tuple_index=2, state_indices={1}, predecessors=[0], successors=[]),\n TupleNode(index=2, tuple_index=7, state_indices={2}, predecessors=[0], successors=[]),\n TupleNode(index=3, tuple_index=8, state_indices={3}, predecessors=[0], successors=[])\n ],\n node_indices_by_distance=[\n [0],\n [1, 2, 3]\n ],\n state_indices_by_distance=[\n [0],\n [1, 2, 3]\n ]\n)"); - EXPECT_EQ(TupleGraph(novelty_base_1, state_space, 1, true).compute_repr(), "TupleGraph(\n root_state_index=1,\n tuple_nodes=[ TupleNode(index=0, tuple_index=1, state_indices={0}, predecessors=[1], successors=[2, 3]),\n TupleNode(index=1, tuple_index=0, state_indices={1}, predecessors=[], successors=[0]),\n TupleNode(index=2, tuple_index=7, state_indices={2}, predecessors=[0], successors=[]),\n TupleNode(index=3, tuple_index=8, state_indices={3}, predecessors=[0], successors=[])\n ],\n node_indices_by_distance=[\n [1],\n [0],\n [2, 3]\n ],\n state_indices_by_distance=[\n [1],\n [0],\n [2, 3]\n ]\n)"); - EXPECT_EQ(TupleGraph(novelty_base_1, state_space, 2, true).compute_repr(), "TupleGraph(\n root_state_index=2,\n tuple_nodes=[ TupleNode(index=0, tuple_index=5, state_indices={0}, predecessors=[1], successors=[2]),\n TupleNode(index=1, tuple_index=0, state_indices={2}, predecessors=[], successors=[0, 3]),\n TupleNode(index=2, tuple_index=8, state_indices={3}, predecessors=[0], successors=[]),\n TupleNode(index=3, tuple_index=2, state_indices={4}, predecessors=[1], successors=[4]),\n TupleNode(index=4, tuple_index=6, state_indices={6}, predecessors=[3], successors=[])\n ],\n node_indices_by_distance=[\n [1],\n [0, 3],\n [2, 4]\n ],\n state_indices_by_distance=[\n [2],\n [0, 4],\n [1, 3, 6]\n ]\n)"); - EXPECT_EQ(TupleGraph(novelty_base_1, state_space, 3, true).compute_repr(), "TupleGraph(\n root_state_index=3,\n tuple_nodes=[ TupleNode(index=0, tuple_index=5, state_indices={0}, predecessors=[2], successors=[1]),\n TupleNode(index=1, tuple_index=7, state_indices={2}, predecessors=[0], successors=[]),\n TupleNode(index=2, tuple_index=0, state_indices={3}, predecessors=[], successors=[0, 3]),\n TupleNode(index=3, tuple_index=2, state_indices={5}, predecessors=[2], successors=[4]),\n TupleNode(index=4, tuple_index=6, state_indices={6}, predecessors=[3], successors=[])\n ],\n node_indices_by_distance=[\n [2],\n [0, 3],\n [1, 4]\n ],\n state_indices_by_distance=[\n [3],\n [0, 5],\n [1, 2, 6]\n ]\n)"); - EXPECT_EQ(TupleGraph(novelty_base_1, state_space, 4, true).compute_repr(), "TupleGraph(\n root_state_index=4,\n tuple_nodes=[ TupleNode(index=0, tuple_index=5, state_indices={0}, predecessors=[1], successors=[]),\n TupleNode(index=1, tuple_index=1, state_indices={2}, predecessors=[2], successors=[0]),\n TupleNode(index=2, tuple_index=0, state_indices={4}, predecessors=[], successors=[1, 4]),\n TupleNode(index=3, tuple_index=8, state_indices={5}, predecessors=[4], successors=[]),\n TupleNode(index=4, tuple_index=6, state_indices={6}, predecessors=[2], successors=[3])\n ],\n node_indices_by_distance=[\n [2],\n [1, 4],\n [0, 3]\n ],\n state_indices_by_distance=[\n [4],\n [2, 6],\n [0, 5, 7]\n ]\n)"); - EXPECT_EQ(TupleGraph(novelty_base_1, state_space, 5, true).compute_repr(), "TupleGraph(\n root_state_index=5,\n tuple_nodes=[ TupleNode(index=0, tuple_index=5, state_indices={0}, predecessors=[1], successors=[]),\n TupleNode(index=1, tuple_index=1, state_indices={3}, predecessors=[3], successors=[0]),\n TupleNode(index=2, tuple_index=7, state_indices={4}, predecessors=[4], successors=[]),\n TupleNode(index=3, tuple_index=0, state_indices={5}, predecessors=[], successors=[1, 4]),\n TupleNode(index=4, tuple_index=6, state_indices={6}, predecessors=[3], successors=[2])\n ],\n node_indices_by_distance=[\n [3],\n [1, 4],\n [0, 2]\n ],\n state_indices_by_distance=[\n [5],\n [3, 6],\n [0, 4, 7]\n ]\n)"); - EXPECT_EQ(TupleGraph(novelty_base_1, state_space, 6, true).compute_repr(), "TupleGraph(\n root_state_index=6,\n tuple_nodes=[ TupleNode(index=0, tuple_index=7, state_indices={4}, predecessors=[2], successors=[]),\n TupleNode(index=1, tuple_index=8, state_indices={5}, predecessors=[2], successors=[]),\n TupleNode(index=2, tuple_index=0, state_indices={6}, predecessors=[], successors=[0, 1, 3]),\n TupleNode(index=3, tuple_index=1, state_indices={7}, predecessors=[2], successors=[])\n ],\n node_indices_by_distance=[\n [2],\n [0, 1, 3]\n ],\n state_indices_by_distance=[\n [6],\n [4, 5, 7]\n ]\n)"); - EXPECT_EQ(TupleGraph(novelty_base_1, state_space, 7, true).compute_repr(), "TupleGraph(\n root_state_index=7,\n tuple_nodes=[ TupleNode(index=0, tuple_index=7, state_indices={4}, predecessors=[2], successors=[]),\n TupleNode(index=1, tuple_index=8, state_indices={5}, predecessors=[2], successors=[]),\n TupleNode(index=2, tuple_index=2, state_indices={6}, predecessors=[3], successors=[0, 1]),\n TupleNode(index=3, tuple_index=0, state_indices={7}, predecessors=[], successors=[2])\n ],\n node_indices_by_distance=[\n [3],\n [2],\n [0, 1]\n ],\n state_indices_by_distance=[\n [7],\n [6],\n [4, 5]\n ]\n)"); } }