Maximum bipartite matching
MatchOriel supports AI-assisted work on assignment problems expressed as allowed pairs. Discuss the edge sets inside your project and review augmenting-path changes without confusing a largest matching with preference stability.
def maximum_matching(edges, right_count):
if type(right_count) is not int or not 0 <= right_count <= 32 or type(edges) not in (list, tuple) or len(edges) > 32:
raise ValueError("matching.size")
if any(type(row) not in (set, frozenset) or any(type(v) is not int or not 0 <= v < right_count for v in row) for row in edges):
raise ValueError("matching.edge")
owners = [-1] * right_count
def augment(left, seen):
for right in sorted(edges[left]):
if right in seen:
continue
seen.add(right)
if owners[right] == -1 or augment(owners[right], seen):
owners[right] = left
return True
return False
for left in range(len(edges)):
augment(left, set())
return sorted((left, right) for right, left in enumerate(owners) if left != -1)Connection
Base URL, credentials and a reachable server.
Project
Test disconnected vertices and reassignment through an augmenting path, rejecting invalid indices without changing the edge sets.
Review before applying
Compare actual behavior with the expected result. If a check fails, investigate it before applying more changes.
def maximum_matching(edges, right_count):
if type(right_count) is not int or not 0 <= right_count <= 32 or type(edges) not in (list, tuple) or len(edges) > 32:
raise ValueError("matching.size")
if any(type(row) not in (set, frozenset) or any(type(v) is not int or not 0 <= v < right_count for v in row) for row in edges):
raise ValueError("matching.edge")
owners = [-1] * right_count
def augment(left, seen):
for right in sorted(edges[left]):
if right in seen:
continue
seen.add(right)
if owners[right] == -1 or augment(owners[right], seen):
owners[right] = left
return True
return False
for left in range(len(edges)):
augment(left, set())
return sorted((left, right) for right, left in enumerate(owners) if left != -1)Make the assignment objective clear before editing
MatchOriel is a Windows AI coding workspace for discussing assignment logic in the context of the application that uses it. Open the source project and explain what makes a pairing allowed and what the result should optimize. Ask the connected assistant to inspect how those requirements appear in the input structure and the code before proposing changes.
A maximum-cardinality matching task provides one example. Bring the allowed pairs and describe whether the goal is simply to assign as many members as possible. Ask the model to review a case where an earlier choice must be reassigned to reach that goal. Keep preference ranking or other business rules explicit if your application needs them, because they are not established by the size of a matching.
Inspect the proposal and test its returned pairs for valid edges and unique membership. Include disconnected members and rejected indices in your own project checks, then review how callers handle unassigned entries. MatchOriel supports OpenAI-compatible or Anthropic endpoint connections with credentials where required. Unrestricted models are selectable where your service offers them; the provider's rules and server's context and tool capabilities still apply. Use the stated objective, rather than the assistant's confidence, to assess whether the change is appropriate.
Reviewing allowed-pair assignments
Does the largest matching also respect preferences?
Not automatically. The illustrated task maximizes the number of assignments among allowed pairs. If preference stability or weighted quality matters, specify that separately and review whether the proposed algorithm addresses that objective rather than only the count.
Why include a case that needs reassignment?
It distinguishes a solution that can revise earlier choices from a greedy pass that may stop too soon. Provide expected pair counts and valid alternatives, then examine the proposed code and its output against those examples.
Should tests require one exact set of pairs?
Only when the contract requires that specific result. Multiple assignments may satisfy the same maximum-cardinality objective. Check validity, unique membership and size, and document any ordering or tie-breaking requirements before making the fixtures stricter.
How should unassigned members reach the caller?
Define whether the caller derives them from missing pairs or expects an explicit representation. Review that boundary with the returned structure, then test disconnected inputs so the application does not treat a legitimate unassigned member as a parsing failure.
MatchOriel · Updated 2026-10-25