Tasks/Operations Research/Combinatorial Optimization

Cyclic event-schedule optimization

Schedule cyclic events with standard library only

periodic_timetabling_pesplib Operations Research Combinatorial Optimization
instruction.mdthis is what the agent is given

Improve a deterministic Python solver that assigns integer phases to events in a repeating schedule. The goal is to reduce weighted cyclic slack and window violations on unseen instances while satisfying the exact submission contract.

Hard Constraints

  • Edit only /app/methods/main/solver.py and keep solve(instance_path, time_budget_s) as the entry point.
  • Use only the Python standard library. Do not access the network, launch external programs, or read files other than the supplied instance and normal interpreter resources.
  • Return exactly one non-boolean integer phase for every event. The evaluator interprets every phase modulo the instance period.
  • Be deterministic for identical inputs, do not modify the input file, and finish within the supplied per-case time budget.
  • Do not assume case identifiers, case counts, periods, event counts, activity counts, or graph structure.

What You Have

/app/public/manifest.json describes 18 visible cases across three precommitted size families. Each referenced JSON file contains exactly:

  • schema_version, case_id, family, period, num_events, and num_activities;
  • activities, a list of directed cyclic-window constraints.

Every activity contains source, target, minimum, maximum, and positive integer weight. Event indices are zero-based, endpoints are distinct, and 0 <= minimum <= maximum < period.

For phases x, an activity gap is (x[target] - x[source]) mod period. Its slack is (gap - minimum) mod period, and its cost is:

weight * (slack + 10 * max(0, slack - (maximum - minimum)))

Lower cost is better. Run python /app/score_visible.py for a like-for-like visible metric broken down by family. Run python /app/selfcheck.py to validate the visible schema, submission contract, determinism, and starter reproducibility.

What You Submit

Submit the edited /app/methods/main/solver.py with this callable interface:

def solve(instance_path: str, time_budget_s: float) -> list[int]:
    ...

The evaluator normalizes each returned integer modulo the case period before computing cost.

How It Is Judged

A separate no-network evaluator stages the submitted Python source, drops privileges, and calls the frozen solver independently on disjoint cases with the same schema and a two-second budget per case. It validates output shape and types, repeats calls to check determinism, verifies input immutability, computes raw cyclic cost, normalizes cases on frozen scales, aggregates within each precommitted family, and then averages the family results. Lower raw metric is better.

Common Pitfalls

  • Hard-coding visible identifiers, dimensions, phase vectors, or family-specific constants instead of parsing each instance.
  • Returning floats, booleans, nested lists, too few phases, or too many phases.
  • Using wall-clock randomness, process-global mutable state, non-standard packages, subprocesses, or network access.
  • Optimizing a non-cyclic difference instead of applying modulo period.
  • Ignoring the excess-slack penalty once the inclusive activity window is exceeded.