Require complete guillotine cutting witnesses for feasibility validation
Browse files
RELEASE_NOTES.md
CHANGED
|
@@ -36,6 +36,7 @@ The feasibility checkers were systematically audited and strengthened:
|
|
| 36 |
- Capacity, flow, balance, linking, integrality, and task-specific constraints are checked where applicable. Geometric checks use numerically stable calculations to avoid overflow-based false acceptance.
|
| 37 |
- Checkers no longer trust fixed problem parameters supplied by a candidate solution.
|
| 38 |
- The affected solver-dependent checkers were converted to validate complete witnesses without invoking an optimization solver at evaluation time.
|
|
|
|
| 39 |
- Checker execution limits and error handling were made more robust for large solutions.
|
| 40 |
|
| 41 |
All published Gurobi reference solutions were revalidated using the updated checkers.
|
|
|
|
| 36 |
- Capacity, flow, balance, linking, integrality, and task-specific constraints are checked where applicable. Geometric checks use numerically stable calculations to avoid overflow-based false acceptance.
|
| 37 |
- Checkers no longer trust fixed problem parameters supplied by a candidate solution.
|
| 38 |
- The affected solver-dependent checkers were converted to validate complete witnesses without invoking an optimization solver at evaluation time.
|
| 39 |
+
- Cutting-stock validation now requires complete guillotine-cut witnesses and checks geometry, material flow, item counts, and objective consistency.
|
| 40 |
- Checker execution limits and error handling were made more robust for large solutions.
|
| 41 |
|
| 42 |
All published Gurobi reference solutions were revalidated using the updated checkers.
|
tasks/furini2016/feasibility_check.py
CHANGED
|
@@ -16,12 +16,11 @@ Constraint numbering (top-to-bottom in the formulation section of math_model.txt
|
|
| 16 |
must equal the recomputed total profit
|
| 17 |
sum_{j in J_bar} p_j * y_j (eq 1).
|
| 18 |
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
- Constraint 5 (x integrality): not directly checkable from y-only solution
|
| 25 |
|
| 26 |
Constraint 7 is an objective-recomputation defense: the objective (eq 1) is a
|
| 27 |
deterministic function of the y variables alone, and the solution carries every
|
|
@@ -34,7 +33,7 @@ import json
|
|
| 34 |
import argparse
|
| 35 |
|
| 36 |
# FRONTIEROR_RELEASE_CONTRACT_V2
|
| 37 |
-
_FRONTIEROR_REQUIRED_SOLUTION_FIELDS = ('items_selected', 'objective_value')
|
| 38 |
_FRONTIEROR_NONEMPTY_SOLUTION_FIELDS = ()
|
| 39 |
_FRONTIEROR_DERIVED_FIELD_RULES = ()
|
| 40 |
_FRONTIEROR_CONDITIONAL_FIELD_RULES = ()
|
|
@@ -202,236 +201,143 @@ def record_violation(violations_list, magnitudes_list, constraint_idx, lhs, rhs,
|
|
| 202 |
|
| 203 |
|
| 204 |
def check_feasibility(instance, solution):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 205 |
"""
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
violated_constraints = set()
|
| 210 |
violations = []
|
| 211 |
magnitudes = []
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 212 |
|
| 213 |
-
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
|
| 218 |
-
|
| 219 |
-
|
| 220 |
-
|
| 221 |
-
|
| 222 |
-
|
| 223 |
-
|
| 224 |
-
|
| 225 |
-
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
|
| 235 |
-
|
| 236 |
-
|
| 237 |
-
|
| 238 |
-
|
| 239 |
-
|
| 240 |
-
|
| 241 |
-
|
| 242 |
-
|
| 243 |
-
|
| 244 |
-
|
| 245 |
-
|
| 246 |
-
|
| 247 |
-
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
|
| 253 |
-
|
| 254 |
-
|
| 255 |
-
|
| 256 |
-
|
| 257 |
-
|
| 258 |
-
|
| 259 |
-
|
| 260 |
-
|
| 261 |
-
|
| 262 |
-
|
| 263 |
-
|
| 264 |
-
|
| 265 |
-
|
| 266 |
-
|
| 267 |
-
|
| 268 |
-
|
| 269 |
-
|
| 270 |
-
|
| 271 |
-
|
| 272 |
-
|
| 273 |
-
|
| 274 |
-
|
| 275 |
-
|
| 276 |
-
|
| 277 |
-
|
| 278 |
-
|
| 279 |
-
|
| 280 |
-
|
| 281 |
-
|
| 282 |
-
|
| 283 |
-
|
| 284 |
-
|
| 285 |
-
|
| 286 |
-
|
| 287 |
-
|
| 288 |
-
|
| 289 |
-
|
| 290 |
-
|
| 291 |
-
|
| 292 |
-
|
| 293 |
-
|
| 294 |
-
|
| 295 |
-
|
| 296 |
-
|
| 297 |
-
|
| 298 |
-
|
| 299 |
-
|
| 300 |
-
|
| 301 |
-
|
| 302 |
-
|
| 303 |
-
|
| 304 |
-
|
| 305 |
-
|
| 306 |
-
|
| 307 |
-
|
| 308 |
-
|
| 309 |
-
|
| 310 |
-
|
| 311 |
-
|
| 312 |
-
|
| 313 |
-
|
| 314 |
-
|
| 315 |
-
|
| 316 |
-
|
| 317 |
-
|
| 318 |
-
|
| 319 |
-
y_per_plate = {}
|
| 320 |
-
for entry in items_selected:
|
| 321 |
-
pid = entry.get('plate_id')
|
| 322 |
-
if pid is None:
|
| 323 |
-
continue
|
| 324 |
-
y_per_plate[pid] = y_per_plate.get(pid, 0) + entry['copies']
|
| 325 |
-
|
| 326 |
-
flow_in = {pid: 0 for pid in plate_ids}
|
| 327 |
-
flow_out = {pid: 0 for pid in plate_ids}
|
| 328 |
-
for c in cuts_used:
|
| 329 |
-
cnt = c.get('count', 0)
|
| 330 |
-
parent = c.get('parent_plate_id')
|
| 331 |
-
c1 = c.get('child1_plate_id')
|
| 332 |
-
c2 = c.get('child2_plate_id')
|
| 333 |
-
if parent is not None:
|
| 334 |
-
flow_out[parent] = flow_out.get(parent, 0) + cnt
|
| 335 |
-
if c1 is not None:
|
| 336 |
-
flow_in[c1] = flow_in.get(c1, 0) + cnt
|
| 337 |
-
if c2 is not None:
|
| 338 |
-
flow_in[c2] = flow_in.get(c2, 0) + cnt
|
| 339 |
-
|
| 340 |
-
# Constraint 1 (eq 2): flow balance for item plates j in J_bar, j != 0
|
| 341 |
-
for pid in plate_ids:
|
| 342 |
-
if pid == 0 or not in_J_bar.get(pid, False):
|
| 343 |
-
continue
|
| 344 |
-
fin = flow_in.get(pid, 0)
|
| 345 |
-
fout = flow_out.get(pid, 0)
|
| 346 |
-
yj = y_per_plate.get(pid, 0)
|
| 347 |
-
lhs = fin - fout - yj
|
| 348 |
-
if lhs < -TOL:
|
| 349 |
-
violated_constraints.add(1)
|
| 350 |
-
record_violation(violations, magnitudes, 1, lhs, 0.0,
|
| 351 |
-
f"Constraint 1 (eq 2): plate {pid} flow balance "
|
| 352 |
-
f"in({fin}) - out({fout}) - y({yj}) = {lhs} < 0")
|
| 353 |
-
|
| 354 |
-
# Constraint 2 (eq 3): flow balance for non-item plates j in J \\ J_bar
|
| 355 |
-
for pid in plate_ids:
|
| 356 |
-
if pid == 0 or in_J_bar.get(pid, False):
|
| 357 |
-
continue
|
| 358 |
-
fin = flow_in.get(pid, 0)
|
| 359 |
-
fout = flow_out.get(pid, 0)
|
| 360 |
-
lhs = fin - fout
|
| 361 |
-
if lhs < -TOL:
|
| 362 |
-
violated_constraints.add(2)
|
| 363 |
-
record_violation(violations, magnitudes, 2, lhs, 0.0,
|
| 364 |
-
f"Constraint 2 (eq 3): plate {pid} flow balance "
|
| 365 |
-
f"in({fin}) - out({fout}) = {lhs} < 0")
|
| 366 |
-
|
| 367 |
-
# Constraint 3 (eq 4): original panel (plate 0) used at most once
|
| 368 |
-
panel_lhs = flow_out.get(0, 0)
|
| 369 |
-
if in_J_bar.get(0, False):
|
| 370 |
-
panel_lhs += y_per_plate.get(0, 0)
|
| 371 |
-
if panel_lhs - 1 > TOL:
|
| 372 |
-
violated_constraints.add(3)
|
| 373 |
-
record_violation(violations, magnitudes, 3, panel_lhs, 1.0,
|
| 374 |
-
f"Constraint 3 (eq 4): panel use {panel_lhs} > 1")
|
| 375 |
-
|
| 376 |
-
# ===================================================================
|
| 377 |
-
# Constraint 5 (eq 6): x variables non-negative integer
|
| 378 |
-
# Not directly checkable from solution (only y values provided).
|
| 379 |
-
# No violation recorded.
|
| 380 |
-
# ===================================================================
|
| 381 |
-
|
| 382 |
-
# ===================================================================
|
| 383 |
-
# Constraint 7 (Tier C, objective consistency):
|
| 384 |
-
# The objective (eq 1) max sum_{j in J_bar} p_j * y_j is a
|
| 385 |
-
# deterministic function of the y variables alone, and the solution
|
| 386 |
-
# carries every y variable (items_selected -> copies). We therefore
|
| 387 |
-
# recompute the true objective exactly and reject as infeasible when
|
| 388 |
-
# the program's self-reported objective_value disagrees beyond a
|
| 389 |
-
# tight tolerance. This defends against LLM score-gaming exploits
|
| 390 |
-
# that fabricate objective_value (e.g. 0 or sys.float_info.max).
|
| 391 |
-
#
|
| 392 |
-
# Full recompute applies because no x / second-stage variable enters
|
| 393 |
-
# the objective -- p_j * y_j depends only on the items kept.
|
| 394 |
-
#
|
| 395 |
-
# The check is skipped (rather than firing a false positive) when the
|
| 396 |
-
# solution references an unknown item type: the recompute cannot be
|
| 397 |
-
# trusted, and such a solution is already infeasible via constraint 6,
|
| 398 |
-
# so no verdict is lost.
|
| 399 |
-
# ===================================================================
|
| 400 |
-
reported_obj = solution.get('objective_value')
|
| 401 |
-
if reported_obj is not None:
|
| 402 |
-
obj_checkable = True
|
| 403 |
-
reported = None
|
| 404 |
-
true_obj = 0.0
|
| 405 |
-
try:
|
| 406 |
-
reported = float(reported_obj)
|
| 407 |
-
for iid, total_copies in y_per_item.items():
|
| 408 |
-
if iid not in item_by_id:
|
| 409 |
-
obj_checkable = False
|
| 410 |
-
break
|
| 411 |
-
true_obj += float(item_by_id[iid]['profit']) * float(total_copies)
|
| 412 |
-
except (TypeError, ValueError):
|
| 413 |
-
obj_checkable = False
|
| 414 |
-
|
| 415 |
-
if obj_checkable and reported is not None:
|
| 416 |
-
abs_diff = abs(reported - true_obj)
|
| 417 |
-
# The objective is an integer (sum of integer profits times
|
| 418 |
-
# integer copies); doubles represent it exactly at this scale.
|
| 419 |
-
# Absolute floor 0.5 catches any integer-level mismatch; the
|
| 420 |
-
# relative term guards huge objectives against solver float noise.
|
| 421 |
-
tol = max(0.5, 1e-6 * abs(true_obj))
|
| 422 |
-
if abs_diff > tol:
|
| 423 |
-
violated_constraints.add(7)
|
| 424 |
-
record_violation(violations, magnitudes, 7, reported, true_obj,
|
| 425 |
-
f"Constraint 7 (objective consistency): reported "
|
| 426 |
-
f"objective_value={reported} differs from recomputed "
|
| 427 |
-
f"sum_j(p_j*y_j)={true_obj} "
|
| 428 |
-
f"(|diff|={abs_diff:.6g}, tol={tol:.6g})")
|
| 429 |
-
|
| 430 |
-
# Build final result
|
| 431 |
-
violated_list = sorted(violated_constraints)
|
| 432 |
-
feasible = len(violated_list) == 0
|
| 433 |
-
|
| 434 |
-
return feasible, violated_list, violations, magnitudes
|
| 435 |
|
| 436 |
|
| 437 |
def main():
|
|
|
|
| 16 |
must equal the recomputed total profit
|
| 17 |
sum_{j in J_bar} p_j * y_j (eq 1).
|
| 18 |
|
| 19 |
+
A complete cutting-flow witness is required. Plate 0 is the trusted input
|
| 20 |
+
panel, all cut positions and child dimensions are checked geometrically,
|
| 21 |
+
all counts are finite nonnegative integers, and every selected item must
|
| 22 |
+
consume a produced plate. Candidate in_J_bar flags are never trusted.
|
| 23 |
+
Total selected area is additionally checked using trusted item dimensions.
|
|
|
|
| 24 |
|
| 25 |
Constraint 7 is an objective-recomputation defense: the objective (eq 1) is a
|
| 26 |
deterministic function of the y variables alone, and the solution carries every
|
|
|
|
| 33 |
import argparse
|
| 34 |
|
| 35 |
# FRONTIEROR_RELEASE_CONTRACT_V2
|
| 36 |
+
_FRONTIEROR_REQUIRED_SOLUTION_FIELDS = ('cuts_used', 'items_selected', 'objective_value', 'plates')
|
| 37 |
_FRONTIEROR_NONEMPTY_SOLUTION_FIELDS = ()
|
| 38 |
_FRONTIEROR_DERIVED_FIELD_RULES = ()
|
| 39 |
_FRONTIEROR_CONDITIONAL_FIELD_RULES = ()
|
|
|
|
| 201 |
|
| 202 |
|
| 203 |
def check_feasibility(instance, solution):
|
| 204 |
+
"""Validate a finite integer cutting-flow witness rooted in one trusted panel.
|
| 205 |
+
|
| 206 |
+
Cut geometry strictly decreases plate area. Together with integer flow
|
| 207 |
+
conservation this forms a DAG that can be expanded into a guillotine
|
| 208 |
+
cutting tree; unproduced plates cannot supply selected items.
|
| 209 |
"""
|
| 210 |
+
import math
|
| 211 |
+
from collections import defaultdict
|
| 212 |
+
|
|
|
|
| 213 |
violations = []
|
| 214 |
magnitudes = []
|
| 215 |
+
constraints = set()
|
| 216 |
+
|
| 217 |
+
def reject(message, constraint=8):
|
| 218 |
+
constraints.add(constraint)
|
| 219 |
+
violations.append(message)
|
| 220 |
+
magnitudes.append({"constraint": constraint, "lhs": 1.0, "rhs": 0.0,
|
| 221 |
+
"raw_excess": 1.0, "normalizer": 1.0, "ratio": 1.0})
|
| 222 |
+
|
| 223 |
+
def integer(value, label, minimum=0):
|
| 224 |
+
# JSON integers are the public contract; integral finite floats also
|
| 225 |
+
# support conventional solver serialization without rounding fractions.
|
| 226 |
+
if isinstance(value, bool) or not isinstance(value, (int, float)):
|
| 227 |
+
raise ValueError(f"{label} must be an integer")
|
| 228 |
+
if isinstance(value, float) and (not math.isfinite(value) or not value.is_integer()):
|
| 229 |
+
raise ValueError(f"{label} must be a finite integer")
|
| 230 |
+
value = int(value)
|
| 231 |
+
if value < minimum:
|
| 232 |
+
raise ValueError(f"{label} must be >= {minimum}")
|
| 233 |
+
return value
|
| 234 |
|
| 235 |
+
try:
|
| 236 |
+
if not isinstance(solution, dict):
|
| 237 |
+
raise ValueError("solution must be an object")
|
| 238 |
+
for name in ("items_selected", "plates", "cuts_used"):
|
| 239 |
+
if name not in solution or not isinstance(solution[name], list):
|
| 240 |
+
raise ValueError(f"Missing or invalid required cutting witness field '{name}'")
|
| 241 |
+
L = integer(instance['panel']['length'], 'panel.length', 1)
|
| 242 |
+
W = integer(instance['panel']['width'], 'panel.width', 1)
|
| 243 |
+
items = {integer(it['id'], 'item.id'): it for it in instance['items']}
|
| 244 |
+
plates = {}
|
| 245 |
+
for entry in solution['plates']:
|
| 246 |
+
if not isinstance(entry, dict):
|
| 247 |
+
raise ValueError('Each plate must be an object')
|
| 248 |
+
pid = integer(entry['id'], 'plate.id')
|
| 249 |
+
if pid in plates:
|
| 250 |
+
raise ValueError(f'Duplicate plate id {pid}')
|
| 251 |
+
length = integer(entry['length'], 'plate.length', 1)
|
| 252 |
+
width = integer(entry['width'], 'plate.width', 1)
|
| 253 |
+
if length > L or width > W:
|
| 254 |
+
raise ValueError(f'Plate {pid} exceeds trusted panel dimensions')
|
| 255 |
+
plates[pid] = (length, width)
|
| 256 |
+
if plates.get(0) != (L, W):
|
| 257 |
+
raise ValueError('Plate 0 must equal the trusted input panel dimensions')
|
| 258 |
+
|
| 259 |
+
used = defaultdict(int)
|
| 260 |
+
per_item = defaultdict(int)
|
| 261 |
+
selected_area = 0
|
| 262 |
+
objective = 0
|
| 263 |
+
for entry in solution['items_selected']:
|
| 264 |
+
if not isinstance(entry, dict):
|
| 265 |
+
raise ValueError('Each selected item must be an object')
|
| 266 |
+
iid = integer(entry['item_id'], 'item_id')
|
| 267 |
+
if iid not in items:
|
| 268 |
+
raise ValueError(f'Unknown item id {iid}')
|
| 269 |
+
count = integer(entry['copies'], 'item copies')
|
| 270 |
+
pid = integer(entry['plate_id'], 'selected plate_id')
|
| 271 |
+
item = items[iid]
|
| 272 |
+
expected = (integer(item['length'], 'item.length', 1),
|
| 273 |
+
integer(item['width'], 'item.width', 1))
|
| 274 |
+
raw_dims = entry['plate_dims']
|
| 275 |
+
if not isinstance(raw_dims, list) or len(raw_dims) != 2:
|
| 276 |
+
raise ValueError('plate_dims must contain two integer dimensions')
|
| 277 |
+
dims = tuple(integer(v, 'plate_dims', 1) for v in raw_dims)
|
| 278 |
+
if dims != expected or plates.get(pid) != expected:
|
| 279 |
+
raise ValueError(f'Item {iid} must reference a declared plate matching its trusted dimensions')
|
| 280 |
+
used[pid] += count
|
| 281 |
+
per_item[iid] += count
|
| 282 |
+
selected_area += expected[0] * expected[1] * count
|
| 283 |
+
objective += integer(item['profit'], 'item.profit', 1) * count
|
| 284 |
+
for iid, count in per_item.items():
|
| 285 |
+
if count > integer(items[iid]['copies'], 'available copies'):
|
| 286 |
+
reject(f'Item {iid} selects {count} copies above the input bound', 4)
|
| 287 |
+
if selected_area > L * W:
|
| 288 |
+
reject(f'Selected item area {selected_area} exceeds panel area {L * W}', 3)
|
| 289 |
+
|
| 290 |
+
incoming = defaultdict(int)
|
| 291 |
+
outgoing = defaultdict(int)
|
| 292 |
+
for cut in solution['cuts_used']:
|
| 293 |
+
if not isinstance(cut, dict):
|
| 294 |
+
raise ValueError('Each cut must be an object')
|
| 295 |
+
parent = integer(cut['parent_plate_id'], 'parent_plate_id')
|
| 296 |
+
if parent not in plates:
|
| 297 |
+
raise ValueError(f'Unknown parent plate {parent}')
|
| 298 |
+
count = integer(cut['count'], 'cut count', 1)
|
| 299 |
+
pos = integer(cut['position'], 'cut position', 1)
|
| 300 |
+
length, width = plates[parent]
|
| 301 |
+
orientation = cut['orientation']
|
| 302 |
+
if orientation == 'h' and pos < width:
|
| 303 |
+
expected = [(length, pos), (length, width - pos)]
|
| 304 |
+
elif orientation == 'v' and pos < length:
|
| 305 |
+
expected = [(pos, width), (length - pos, width)]
|
| 306 |
+
else:
|
| 307 |
+
raise ValueError('Cut orientation/position must split the parent strictly inside its dimensions')
|
| 308 |
+
for field, dims in zip(('child1_plate_id', 'child2_plate_id'), expected):
|
| 309 |
+
if field not in cut:
|
| 310 |
+
raise ValueError(f'Missing cut field {field}; use null for discarded material')
|
| 311 |
+
raw_child = cut[field]
|
| 312 |
+
if raw_child is None:
|
| 313 |
+
continue # Discarded residual material cannot provide items.
|
| 314 |
+
child = integer(raw_child, field)
|
| 315 |
+
if child not in plates or plates[child] != dims:
|
| 316 |
+
raise ValueError(f'{field} dimensions do not match the trusted cut geometry')
|
| 317 |
+
incoming[child] += count
|
| 318 |
+
outgoing[parent] += count
|
| 319 |
+
|
| 320 |
+
# Never trust candidate in_J_bar flags: every selected item consumes
|
| 321 |
+
# a plate, including items matching the complete input panel.
|
| 322 |
+
if outgoing[0] + used[0] > 1:
|
| 323 |
+
reject('Original panel is consumed more than once', 3)
|
| 324 |
+
if incoming[0] != 0:
|
| 325 |
+
reject('Cuts cannot produce the original panel', 3)
|
| 326 |
+
for pid in plates:
|
| 327 |
+
if pid != 0 and outgoing[pid] + used[pid] > incoming[pid]:
|
| 328 |
+
reject(f'Plate {pid} consumes {outgoing[pid] + used[pid]} copies but only {incoming[pid]} are produced', 1)
|
| 329 |
+
|
| 330 |
+
reported = solution.get('objective_value')
|
| 331 |
+
if isinstance(reported, bool) or not isinstance(reported, (int, float)):
|
| 332 |
+
raise ValueError('objective_value must be a finite number')
|
| 333 |
+
if isinstance(reported, float) and not math.isfinite(reported):
|
| 334 |
+
raise ValueError('objective_value must be finite')
|
| 335 |
+
if not math.isclose(reported, objective, rel_tol=1e-9, abs_tol=1e-6):
|
| 336 |
+
reject(f'Reported objective {reported} differs from trusted recomputed profit {objective}', 7)
|
| 337 |
+
except (KeyError, TypeError, ValueError, OverflowError) as exc:
|
| 338 |
+
reject(f'Invalid cutting witness: {exc}')
|
| 339 |
+
|
| 340 |
+
return not violations, sorted(constraints), violations, magnitudes
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 341 |
|
| 342 |
|
| 343 |
def main():
|
tasks/furini2016/mathematical_formulation.md
CHANGED
|
@@ -55,3 +55,7 @@ $$\begin{align}
|
|
| 55 |
&x^o_{qj} \;\ge\; 0\ \text{integer}, && j\in J,\ o\in O,\ q\in Q(j,o) \tag{6}\\[4pt]
|
| 56 |
&y_j \;\ge\; 0\ \text{integer}, && j\in\bar J \tag{7}
|
| 57 |
\end{align}$$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
&x^o_{qj} \;\ge\; 0\ \text{integer}, && j\in J,\ o\in O,\ q\in Q(j,o) \tag{6}\\[4pt]
|
| 56 |
&y_j \;\ge\; 0\ \text{integer}, && j\in\bar J \tag{7}
|
| 57 |
\end{align}$$
|
| 58 |
+
|
| 59 |
+
## Output witness convention
|
| 60 |
+
|
| 61 |
+
Report the integer x and y witness as `cuts_used`, `plates`, and `items_selected` with `plate_id`, as detailed in solution_schema.json. Plate 0 is the trusted input panel. Horizontal cuts split width; vertical cuts split length, always at a strictly internal positive integer position. Null children discard residuals. Geometrically validated cuts strictly decrease plate area, so the plate flow is acyclic. For every nonroot plate, produced copies must cover cut consumption plus retained items; root consumption is at most one. These checks provide a constructive guillotine cutting witness without invoking an optimizer. The selected item area must also not exceed panel area; this necessary check alone is not sufficient.
|
tasks/furini2016/problem_description.txt
CHANGED
|
@@ -7,3 +7,5 @@ All cuts must be guillotine cuts, meaning each cut is a straight line that runs
|
|
| 7 |
The cutting process works as follows. The original panel is the initial plate. Any plate may be split by a single guillotine cut into two smaller plates. Each of those smaller plates may in turn be split again, and so on recursively. A plate whose dimensions exactly match those of some item type may instead be kept as a finished item rather than being cut further. Any plate that is too small to contain any item is discarded. The process continues until every remaining plate has either been kept as an item or discarded.
|
| 8 |
|
| 9 |
The manufacturer must decide how to recursively cut the original panel and which resulting item-sized plates to retain as finished items. The number of finished items of each type kept cannot exceed that type's maximum available copies. The quantity to maximize is the sum over all retained items of the item's profit times the number of copies retained.
|
|
|
|
|
|
|
|
|
| 7 |
The cutting process works as follows. The original panel is the initial plate. Any plate may be split by a single guillotine cut into two smaller plates. Each of those smaller plates may in turn be split again, and so on recursively. A plate whose dimensions exactly match those of some item type may instead be kept as a finished item rather than being cut further. Any plate that is too small to contain any item is discarded. The process continues until every remaining plate has either been kept as an item or discarded.
|
| 8 |
|
| 9 |
The manufacturer must decide how to recursively cut the original panel and which resulting item-sized plates to retain as finished items. The number of finished items of each type kept cannot exceed that type's maximum available copies. The quantity to maximize is the sum over all retained items of the item's profit times the number of copies retained.
|
| 10 |
+
|
| 11 |
+
Output feasibility witness: provide the selected item counts together with a complete integer cutting-flow witness using the plates, cuts_used, and item plate_id fields defined in solution_schema.json. Plate 0 is the single input panel. Each cut consumes one parent plate and creates the two geometrically determined children; a null child ID discards that residual. Every selected copy consumes a plate with exactly the input item dimensions. The total number of cuts and selected copies consuming a plate type cannot exceed its produced count; the original panel can be consumed at most once. Plate type IDs may aggregate geometrically identical residuals. Candidate in_J_bar flags are unnecessary and are not trusted.
|
tasks/furini2016/solution_schema.json
CHANGED
|
@@ -4,7 +4,25 @@
|
|
| 4 |
{
|
| 5 |
"item_id": "<int> Identifier of the item type that is kept as a finished item.",
|
| 6 |
"plate_dims": "<list[int], length 2> Length and width of the finished item kept.",
|
| 7 |
-
"copies": "<int> Number of finished copies retained of this item type."
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
}
|
| 9 |
]
|
| 10 |
}
|
|
|
|
| 4 |
{
|
| 5 |
"item_id": "<int> Identifier of the item type that is kept as a finished item.",
|
| 6 |
"plate_dims": "<list[int], length 2> Length and width of the finished item kept.",
|
| 7 |
+
"copies": "<int> Number of finished copies retained of this item type.",
|
| 8 |
+
"plate_id": "<int> ID of the declared plate consumed by these finished copies; its dimensions must equal the trusted item dimensions."
|
| 9 |
+
}
|
| 10 |
+
],
|
| 11 |
+
"plates": [
|
| 12 |
+
{
|
| 13 |
+
"id": "<int> Unique nonnegative plate type ID. ID 0 must have the input panel dimensions. Only root and referenced plates need to be listed.",
|
| 14 |
+
"length": "<int> Positive integer length, at most panel.length.",
|
| 15 |
+
"width": "<int> Positive integer width, at most panel.width."
|
| 16 |
+
}
|
| 17 |
+
],
|
| 18 |
+
"cuts_used": [
|
| 19 |
+
{
|
| 20 |
+
"parent_plate_id": "<int> Declared plate consumed by this cut.",
|
| 21 |
+
"orientation": "<str> 'h' splits width; 'v' splits length.",
|
| 22 |
+
"position": "<int> Strictly between zero and the split parent dimension.",
|
| 23 |
+
"child1_plate_id": "<int|null> First child plate ID, or null to discard it. For h its dimensions are (parent.length, position); for v (position, parent.width).",
|
| 24 |
+
"child2_plate_id": "<int|null> Second child plate ID, or null to discard it. For h its dimensions are (parent.length, parent.width-position); for v (parent.length-position, parent.width).",
|
| 25 |
+
"count": "<int> Positive integer number of times this cut is applied."
|
| 26 |
}
|
| 27 |
]
|
| 28 |
}
|