Skip to content

Commit daace92

Browse files
committed
Add danger-zone failure and console messages
Introduce a mock "danger zone" in the solver where rows with Length > 8.0 and Angle > 30.0 produce no signal (Signal set to None) and are counted as failed/crashed. Update solver output to report the number of crashed rows when present. Add informational prints to demo_optimise notifying users about the rigged failure and change the final dataset summary message to say "valid rows". This makes the Graveyard/blocking behavior visible during optimisation demos.
1 parent d286fc6 commit daace92

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

scripts/demo_optimise.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ def main():
2626
outcome_col="Signal"
2727
)
2828

29+
print("\n[!] NOTE: The mock solver is rigged to fail if Length > 8.0 AND Angle > 30.0.")
30+
print(" Watch the console output to see the Graveyard actively block these regions!")
31+
2932
print("\n--- 3. Running optimise() ---")
3033
study.optimise(
3134
command=solver_cmd,
@@ -36,7 +39,7 @@ def main():
3639
)
3740

3841
print("\n--- 4. Results ---")
39-
print(f"Final Dataset Size: {len(study.data)} rows")
42+
print(f"Final Dataset Size: {len(study.data)} valid rows")
4043

4144
print("\n--- 5. Visualisation ---")
4245
try:

scripts/solver.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,20 @@ def run_simulation(input_path, output_path):
2626

2727
df['Signal'] = np.abs(signal + noise)
2828

29+
# --- THE TRAP: Create a "Danger Zone" to trigger the Graveyard ---
30+
# If Length > 8 and Angle > 30, the "part breaks" and returns no signal.
31+
danger_mask = (df['Length'] > 8.0) & (df['Angle'] > 30.0)
32+
df.loc[danger_mask, 'Signal'] = None
33+
34+
failed_count = danger_mask.sum()
35+
2936
# 3. Write Outputs
3037
try:
3138
df.to_csv(output_path, index=False)
32-
print(f"Solver: Successfully processed {len(df)} rows.")
39+
if failed_count > 0:
40+
print(f"Solver: Processed {len(df)} rows ({failed_count} crashed in the danger zone).")
41+
else:
42+
print(f"Solver: Successfully processed {len(df)} rows.")
3343
except Exception as e:
3444
print(f"Solver Error: Could not write {output_path}. {e}")
3545
sys.exit(1)

0 commit comments

Comments
 (0)