Evaluating AI Coding Capabilities with Verifiable Problems: A Time-Dependent Path Planning Case Study

    This article argues that AI coding evaluation should rely on verifiable technical problems rather than generator-solver-judge loops alone. Using a directed graph with periodic edge availability, it shows why earliest-arrival shortest path logic is insufficient for a three-level objective, examines state dominance and path lexicographic issues, presents an exact small-scale baseline, and outlines test and delivery criteria for assessing generated code.

    1. Evaluating AI Coding Capability Should Start from Verifiable Problems

    A common way to evaluate intelligent coding tools is to have one tool generate a problem, another tool solve it, and then use an automated review to judge the result. This approach can help discover issues, but it is not suitable for forming reliable conclusions on its own.

    The reason is that problem generation, solving, and review can all contain errors. This is especially true for complex algorithm problems. A generated program may be syntactically correct, pass sample cases, and even include what appears to be a complete proof, while its core state design is still invalid. Without independent verification during review, such errors can easily be presented as “correct answers.”

    A more valuable evaluation target is how a tool handles the process of solving a technical problem:

    • Does it accurately understand the priority order of objectives in the problem?
    • Does it identify changes in the conditions under which a classic algorithm applies?
    • Does it actively construct counterexamples instead of mechanically applying templates?
    • Does it distinguish between “the result is correct” and “the solution scales”?
    • Does it clearly state limitations when feasibility cannot be proven?

    The following example uses a directed graph problem with periodic traversal rules to analyze how these capabilities can be grounded in testable technical details.

    2. Problem Modeling: This Is Not an Ordinary Shortest Path

    Consider a directed graph with vertices numbered 0 through n-1. Each edge contains six fields:

    1. (u, v, phase, period, duration, cost)

    They represent the start vertex, end vertex, open phase, open period, traversal duration, and traversal cost, respectively.

    If the arrival time at vertex u is T, the departure time along this edge must satisfy:

    1. (depart + phase) % period == 0

    If departure is not possible at the current time, the traveler must wait until the next legal departure time. The goal is to travel from the start vertex to the target vertex while optimizing in the following order:

    1. Earliest arrival time;
    2. Among earliest-arrival solutions, lowest total cost;
    3. Among solutions with the same time and cost, lexicographically smallest vertex sequence.

    These three objectives have a strict priority order and cannot be casually combined into a single weighted score. Even if one path has a much lower cost, it cannot be the final answer if it arrives later than another path.

    The original problem also has a large input scale: the number of vertices can reach 200,000, the number of edges can reach 300,000, and the start time can reach 10^18. Therefore, an acceptable solution must not only compute the correct answer but also explain time complexity, space complexity, and integer arithmetic safety.

    3. First Basic Check: Waiting Time Must Be Computed with Integers

    Let the arrival time be T, the open phase be p, and the open period be q. Under non-negative integer modulo semantics, the waiting time can be written as:

    1. wait = (q - ((T + p) % q)) % q
    2. depart = T + wait
    3. arrival = depart + duration

    This calculation contains several important boundary conditions:

    • When T already satisfies the open condition, the waiting time should be zero;
    • When the period is one, departure is allowed at any integer time;
    • Large time values must not be converted to floating-point calculations;
    • In fixed-width integer environments, addition overflow must also be checked.

    During implementation, T can also be reduced modulo q first to lower the numeric range of intermediate additions:

    1. remainder = ((T % q) + p) % q
    2. wait = (q - remainder) % q

    Because periods and phases have explicit upper bounds, this makes intermediate results easier to analyze. However, the final arrival time and cumulative cost still need separate numeric range analysis.

    These details are suitable for automated tests, but they are not the hardest part of this problem. The real difficulty is preserving enough information to complete the three-level optimization.

    4. Earliest Arrival Time Can Be Computed, but the Full Answer Cannot Use a Template

    For an edge with periodic availability, the earlier the arrival at its start vertex, the earlier the earliest usable departure time will be—or at least not later. This means the edge’s arrival-time function is nondecreasing, commonly called the first-in-first-out property.

    Therefore, if the only objective is “earliest arrival at the target,” a label-setting shortest path method based on a priority queue can be used. Each vertex keeps one earliest arrival time, and the edge relaxation operation computes the next legal departure time from the current time.

    With a reasonable data structure implementation, this stage usually has:

    1. Time complexity: O((n + m) log n)
    2. Space complexity: O(n + m)

    However, this does not imply that the full problem can be solved by the same method after extending the label from “time” to “time, cost, path.”

    One counterexample is enough to show the issue

    Consider the following three edges with a start time of zero:

    1. s -> u: period 1, phase 0, duration 1, cost 100
    2. s -> u: period 1, phase 0, duration 2, cost 0
    3. u -> t: period 10, phase 0, duration 1, cost 0

    There are two ways to reach the intermediate vertex u:

    Solution Arrival time at u Cumulative cost
    Solution A 1 100
    Solution B 2 0

    The edge from u to t can only be departed when the time is a multiple of ten. Therefore, both solutions wait until time ten to depart and arrive at the target at time eleven.

    The final answer should choose Solution B, because both have the same arrival time and Solution B has lower cost.

    If the algorithm keeps only the earliest arrival label for u, it will discard Solution B and return an incorrect result.

    The core conclusion is: arriving earlier at an intermediate vertex does not necessarily dominate a later-arriving state. Periodic waiting may erase the time difference, but it does not erase the cost difference.

    5. Multi-Label Is Not a One-Line Patch

    After discovering the single-label error, a natural idea is to store multiple states per vertex:

    1. state = arrival time, cumulative cost, path information

    For the case considering only time and cost, if state A arrives earlier than or at the same time as state B and has no higher cost, then A can usually dominate B for future time and cost objectives.

    However, after adding lexicographic path order, the deletion rule requires more care.

    For example, a state that arrives earlier with the same cost may, after subsequent waiting, reach the target at the same time as another state. In that case, the final choice depends on the full path, not on the arrival time at the intermediate vertex.

    More complex still, lexicographic comparison involves prefix relationships between sequences. Without proof, one cannot assume that if the current path is lexicographically smaller, it will remain smaller after appending the same suffix. If two sequences have a proper prefix relationship, appending elements may change the comparison result.

    Therefore, a multi-label algorithm must answer at least three questions:

    1. Under what conditions can a state be safely deleted?
    2. Is there a provable upper bound on the number of retained states?
    3. Will path comparison and path storage become the main overhead?

    If these questions are not resolved, merely writing a program that “maintains non-dominated labels” does not prove that it applies to graphs with hundreds of thousands of vertices.

    6. An Exact Baseline for Verification

    Although it is not easy to provide an efficient full algorithm that satisfies the original scale, it is possible to build a clear, explainable exact baseline for small-scale verification.

    Step 1: Compute only the earliest arrival time at the target

    First use an algorithm that optimizes only time to obtain the earliest arrival time A.

    If the target is unreachable, return an empty result directly. Otherwise, only consider states with arrival time no greater than A.

    Step 2: Expand states to “vertex and time”

    Create states:

    1. (v, T)

    where v is a vertex and T is the actual arrival time at that vertex.

    When transitioning from this state along an edge, compute the nearest legal departure time and then the new arrival time. If it exceeds A, it can be discarded, because edge durations are strictly positive and it is impossible to return to an earlier time afterward.

    For the same (v, T) state, keep only:

    • The solution with the lowest cumulative cost;
    • If costs are equal, the solution with the lexicographically smallest full vertex path.

    This merge rule is easier to prove than pruning across different time states. The future available transitions from the same state are identical. Also, because durations are strictly positive, two different paths that reach the same vertex at the same time cannot be proper prefixes of each other. Therefore, when costs are equal, the lexicographic path choice can be safely propagated to a common suffix.

    Step 3: Process in increasing time order

    All transitions increase time, so the expanded state graph has no time backtracking. States can be processed in increasing arrival time order, and the best cost and path at (t, A) can be read at the end.

    However, it must be stated clearly: exact does not mean efficient.

    The graph may contain cycles, and the time range may be very large, so the number of expanded states can far exceed the original graph size. This method is suitable for constructing trustworthy small-scale answers. It should not be claimed to satisfy the original constraints without further proof.

    7. Lexicographic Order and Path Recovery Also Need Independent Validation

    Even if time and cost are handled correctly, lexicographic path order can still be wrong.

    Do not compare only predecessor IDs

    Two paths may be:

    1. [0, 2, 9, 7]
    2. [0, 3, 1, 7]

    The first path is lexicographically smaller because at the first differing position, 2 < 3. Comparing only the vertex before the target would produce an incorrect judgment.

    Do not treat adjacency-list sorting as proof

    Sorting by adjacent vertex ID changes the search order at most. If the algorithm discards necessary states early, an ordered traversal cannot recover the correct answer.

    Do not copy the entire path at no cost

    Copying the vertex sequence during every relaxation can cause significant time and memory overhead. A small-scale baseline can be implemented this way for verification, but a large-scale implementation needs to analyze shared path structures, parent pointers, and the cost of full sequence comparison.

    In addition, hashing can assist path comparison, but it carries collision risk. If strict correctness is required, a deterministic comparison mechanism or reliable collision verification is needed. Probabilistic judgments cannot be treated directly as mathematical proof.

    8. Tests Should Cover “Algorithm Assumptions,” Not Just Input Boundaries

    A reliable test suite should include at least the following categories.

    1. Basic semantics tests

    Check cases such as period one, no waiting required, waiting required, unreachable targets, and multiple edges.

    When the start equals the target, an empty walk has already arrived at the start time. Because durations are strictly positive and costs are non-negative, the answer should be:

    1. (start_time, 0, [s])

    2. Objective conflict tests

    Focus on constructing cases where:

    • A path reaches an intermediate vertex earlier but has higher cost;
    • Two paths arrive at the target at the same time after waiting;
    • Time and cost are the same, but the full path lexicographic order differs;
    • A state looks locally better but is not globally optimal.

    These tests directly check whether state compression is safe.

    3. Numeric and resource tests

    Check large integer times, cumulative cost ranges, dense multiple edges, long paths, and large numbers of candidate labels. In addition to output results, record runtime, peak memory, and state count.

    4. Randomized differential tests

    Generate random instances on small graphs, compute answers with the exact baseline, and compare them with the implementation under test. When a difference appears, progressively remove irrelevant edges and reduce parameters to obtain a minimal counterexample.

    A minimal counterexample is usually more valuable than a general automated review because it clearly demonstrates which assumption of the algorithm fails.

    9. Engineering Evaluation Needs to Distinguish Three Delivery Levels

    For developers and enterprise users, intelligent coding results can be divided into three levels:

    Level 1: Demo runnable.
    The program passes a few samples, but correctness and complexity have not been verified.

    Level 2: Boundaries explainable.
    The program has explicit state definitions, counterexample analysis, test coverage, and a clear scope of applicability.

    Level 3: Production acceptable.
    On top of Level 2, it also has resource budgets, exception handling, observability, regression tests, and a clear failure strategy.

    When adopting generated code, enterprises should require deliverables to include the implementation, tests, correctness rationale, and complexity explanation—not just a function. For solutions that cannot satisfy the original scale, the additional constraints required should be stated, such as limiting the number of candidate states, reducing the time range, or simplifying optimization objectives.

    These constraints must come from the actual business context. They must not be added to the problem without authorization just to make the algorithm work.

    10. Conclusion: Reasoning and Validation Are What Deserve Evaluation

    Periodic path planning reveals a typical trap: an algorithm may correctly solve the first-priority objective, but it may not be able to solve the full problem by simply adding more sorting fields.

    When evaluating AI coding capability, the most important factors are not output speed or explanation length. What matters is whether the tool can:

    • Identify how the waiting mechanism affects state dominance;
    • Use concrete counterexamples to reject unsafe optimizations;
    • Distinguish between an exact baseline and a scalable solution;
    • Provide an independent argument for lexicographic path order;
    • Honestly state capability boundaries when proof is missing.

    The original material does not provide a complete second problem, so no further algorithm conclusion can be extended from it. Building a reproducible chain of evidence around a known problem is more consistent with professional technical evaluation than judging a specific tool based on scattered answer performance.

    For developers, this method also applies to everyday code review: first check the model and assumptions, then check the implementation and resources, and finally verify results through counterexamples and independent tests. Only when this chain is complete can generated code move from “looks plausible” to “safe to use.”