Skip to content

Commit 183ab16

Browse files
committed
Fix parents in JSON search tree export for rectangleguillotine
1 parent d30f383 commit 183ab16

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/rectangleguillotine/branching_scheme.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1878,9 +1878,16 @@ nlohmann::json BranchingScheme::json_export(
18781878

18791879
Solution solution = to_solution(node, true);
18801880

1881+
auto parent = node->parent;
1882+
while (parent != nullptr
1883+
&& parent->item_type_id_1 == -1
1884+
&& parent->item_type_id_2 == -1) {
1885+
parent = parent->parent;
1886+
}
1887+
NodeId parent_id = (parent != nullptr)? parent->id: -1;
18811888
nlohmann::json json = {
18821889
{"Id", node->id},
1883-
{"ParentId", (node->parent == nullptr)? -1: node->parent->id},
1890+
{"ParentId", parent_id},
18841891
{"Data",
18851892
{
18861893
{"ItemTypeId1", node->item_type_id_1},

0 commit comments

Comments
 (0)