From d4e97b551abc0218c4f37c317da64c51652efcd6 Mon Sep 17 00:00:00 2001 From: Kento HASEGAWA Date: Mon, 19 Aug 2019 02:44:07 +0900 Subject: [PATCH] Support for multi-group problems at hsgw-solver --- solvers/hsgw | 2 +- utils/__init__.py | 2 +- utils/data.py | 10 +++++++--- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/solvers/hsgw b/solvers/hsgw index 5e5c487..f2e4e6c 160000 --- a/solvers/hsgw +++ b/solvers/hsgw @@ -1 +1 @@ -Subproject commit 5e5c48717d206c28cf08e7295c19b8a22346a7c5 +Subproject commit f2e4e6c80ba0d717151dbbe38e99f69691658e2f diff --git a/utils/__init__.py b/utils/__init__.py index e5c5520..be4439c 100644 --- a/utils/__init__.py +++ b/utils/__init__.py @@ -1 +1 @@ -from .data import Problem +from .data import Problem, Solution diff --git a/utils/data.py b/utils/data.py index c070708..8e33a9c 100644 --- a/utils/data.py +++ b/utils/data.py @@ -80,8 +80,12 @@ class Problem(object): problem_text = '' num_tiles = 0 line_remap_list = list() + line_remap_list.append(0) + block_remap_list = list() + block_remap_list.append(0) block_text = '' for bi, bn in enumerate(g): + block_remap_list.append(bn) b = self.blocks[bn] num_tiles += b['num_tiles'] @@ -93,7 +97,7 @@ class Problem(object): if isinstance(bc, int) and bc > 0: if not bc in line_remap_list: line_remap_list.append(bc) - remapped_index = line_remap_list.index(bc) + 1 + remapped_index = line_remap_list.index(bc) br_cells.append(str(remapped_index)) else: br_cells.append(str(bc)) @@ -106,7 +110,7 @@ class Problem(object): problem_text += '\n' problem_text += block_text - group_problems.append(problem_text) + group_problems.append((problem_text, line_remap_list, block_remap_list)) return group_problems @@ -348,7 +352,7 @@ class Solution(object): self._id = str(uuid.uuid4()) self._parse_solution() - + def _parse_solution(self): if self.status != 'done': -- 2.22.0