aboutsummaryrefslogtreecommitdiff
path: root/src_py
diff options
context:
space:
mode:
Diffstat (limited to 'src_py')
-rw-r--r--src_py/opcut/csp.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/src_py/opcut/csp.py b/src_py/opcut/csp.py
index 04a6d39..209acec 100644
--- a/src_py/opcut/csp.py
+++ b/src_py/opcut/csp.py
@@ -14,15 +14,15 @@ State = util.namedtuple(
Panel = util.namedtuple(
'Panel',
+ ['id', 'Any'],
['width', 'float'],
- ['height', 'float'],
- ['label', 'str'])
+ ['height', 'float'])
Item = util.namedtuple(
'Item',
+ ['id', 'Any'],
['width', 'float'],
['height', 'float'],
- ['label', 'str'],
['rotate', 'bool'])
Used = util.namedtuple(
@@ -33,7 +33,7 @@ Used = util.namedtuple(
['y', 'float'],
['rotate', 'bool'])
-Unused = util.namespace(
+Unused = util.namedtuple(
'Unused',
['panel', 'Panel'],
['width', 'float'],
@@ -189,9 +189,9 @@ def _fitness(state):
result = 0
for panel in state.panels:
used_areas = [used.item.width * used.item.height
- for used in panel.used]
+ for used in state.used]
unused_areas = [unused.width * unused.height
- for unused in panel.unused]
+ for unused in state.unused]
result += (panel.width * panel.height - sum(used_areas)) / total_area
result -= (_fitness_K *
min(used_areas, default=0) * max(unused_areas, default=0) /