Chapter 10
Combinatorial problem solving
Many planning and design questions are classical problems on hypergraphs in disguise: which resources must be monitored so that every activity is observed (a hitting set), which activities cover all resources (a set cover), which groups can run in parallel (a matching), which tables can be joined efficiently (acyclicity and join trees), which products can be made from the available parts and at what cost (reachability and shortest paths in a directed hypergraph), and which engineering specifications should be developed to satisfy the customers (quality function deployment). This chapter states these problems, their integer-programming formulations, the greedy and exact algorithms of hatvis, and the structural results (duality, Berge’s transversal theorem, the join-tree characterization) that make them tractable or explain why they are hard. The examples come from the manufacturing space, a database schema, a wire-harness assembly, and the electric-car house of quality.
10.1 Problem and idea
A graph models a requirement on pairs: an edge must be covered by one of its endpoints, two adjacent vertices must get different colors, a path passes through pairs. Real requirements often involve groups. An activity is observed if any one of its resources carries a sensor; an assembly step can start only when all its parts are available; a requirement of a product is met by some combination of specifications; a database query joins several tables that share attributes. Encoding these as graphs either loses the group (a set cover becomes a vertex cover of the clique expansion, which is a different and usually larger problem) or needs auxiliary constructions that hide the structure.
The idea of this chapter is to formulate the problems directly on the hypergraph, where they have short integer programs and well-understood theory. Two dualities run through the chapter (fig. 10.1). The hitting set of is the set cover of its dual , so every covering algorithm solves both; and for a simple hypergraph the family of minimal transversals determines the hypergraph again, [16], so the “what must I monitor” and “what can fail” questions are two views of one object.
10.2 Theory
10.2.1 Covering and hitting
A set cover of is a family of hyperedges whose union contains every vertex (of a given universe , by default all non-isolated vertices); a hitting set or transversal is a set of vertices that meets every hyperedge. With costs and , the minimum-cost versions are the integer programs
The constraint matrix of one is the transpose of the other, which is the duality of fig. 10.1. Both are NP-hard [107], but integer programs of a few thousand variables are solved to optimality in seconds by branch and bound; hatvis passes them to the HiGHS solver [28] through scipy.optimize.milp. The greedy algorithm repeatedly takes the hyperedge with the smallest cost per newly covered vertex, , until everything is covered; Chvátal [130] proved that its cost is at most times the optimum, where . The greedy hitting set is the greedy set cover of the dual.
Minimal transversals. A transversal is minimal if no proper subset is a transversal. The family of all minimal transversals is the transversal (or blocker) hypergraph , and for a simple hypergraph [16]. Minimal transversals answer “what are all the irredundant ways to monitor the system” and, read the other way, “what are all the minimal sets of failures that disable every activity”. Berge’s sequential algorithm processes the hyperedges one at a time,
|
| (10.3) |
where keeps the inclusion-minimal sets. The output can be exponential in the input, so the right measure of efficiency is the time per output set; Eiter and Gottlob [131] showed that enumerating minimal transversals is equivalent to a family of problems in logic, databases, and artificial intelligence, and Fredman and Khachiyan [132] gave an algorithm that is quasi-polynomial in the combined size of input and output. hatvis implements Berge’s method with an optional size limit, adequate for subsystems of moderate size.
10.2.2 Matching and coloring
A matching is a set of pairwise disjoint hyperedges; a maximum-weight matching, subject to , selects the largest set of groups that can act simultaneously when every vertex can take part in only one group, such as a schedule of activities that do not share resources. A weak (proper) coloring assigns colors to vertices so that no hyperedge of size at least two is monochromatic; a strong coloring requires all members of every hyperedge to have different colors, which is a proper coloring of the clique expansion. A hypergraph with a weak 2-coloring has Property B; deciding Property B is the NP-complete set splitting problem [133]. Strong colorings assign time slots to the vertices so that no group has two members in the same slot; weak 2-colorings split a set of items into two parts so that every group is represented in both. hatvis provides greedy colorings of both kinds and a backtracking decision procedure for Property B on small hypergraphs.
10.2.3 Acyclicity and join trees
A hypergraph is -acyclic if it can be reduced to nothing (or to a single hyperedge) by the GYO reduction [134]: repeatedly delete a vertex that belongs to exactly one hyperedge (an ear vertex), and delete a hyperedge that is empty or contained in another hyperedge. The order of the deletions does not affect the outcome, and Tarjan and Yannakakis [135] gave a linear-time test. Acyclicity has an equivalent characterization by join trees: a tree on the hyperedges is a join tree if, for every vertex, the hyperedges that contain it form a connected subtree (the running intersection property). A hypergraph has a join tree if and only if it is -acyclic, and the join trees are exactly the maximum-weight spanning trees of the intersection graph of the hyperedges with weights [136, 137]. hatvis computes a join tree in this way and rejects cyclic inputs.
Acyclicity was identified in database theory as the property of a relational schema that makes queries efficient [138]: the tables are the hyperedges, the attributes the vertices, and for an acyclic schema a join of all tables can be computed by semijoins along the join tree in time polynomial in the size of input and output [139], while for cyclic schemas the intermediate results can blow up. Fagin [140] defined a hierarchy of stronger notions (-, -, and Berge-acyclicity). The same structure appears in probabilistic inference, where junction trees of graphical models are join trees of the hypergraph of cliques, and in constraint satisfaction.
Two further properties are tested by hatvis: conformality (section 2.2.4) and the Helly property, which holds when every pairwise intersecting family of hyperedges has a common vertex. A hypergraph is conformal exactly when its dual has the Helly property, and the Helly property can be tested with the triangle criterion of Berge and Duchet in time [16].
10.2.4 Directed hypergraphs: reachability and hyperpaths
A directed hypergraph whose hyperarcs have a single head vertex is a set of B-arcs, and it models AND-dependencies: the head can be produced only when every tail vertex is available [33, 34]. A vertex is B-reachable from a set of sources if it is in or is the head of a hyperarc all of whose tail vertices are B-reachable. The B-visit computes the reachable set in linear time by keeping, for every hyperarc, the number of tail vertices not yet reached and firing the hyperarc when the counter drops to zero. A B-hyperpath to a vertex is the set of hyperarcs used to reach it.
With a weight on every hyperarc, Gallo et al. [33] define the cost of reaching a head vertex through hyperarc as
|
| (10.4) |
with (the total effort of all steps needed, counting every sub-assembly) or (the completion time when independent preparations run in parallel, the makespan). Both are computed by a Dijkstra-like procedure (the SBT procedure of Gallo et al.) that settles the vertices in order of increasing and evaluates a hyperarc once all its tail vertices are settled. The additive cost counts a sub-assembly once for every use, so it is exact for tree-shaped assemblies and an upper bound when a part feeds several branches. Directed hypergraphs of this kind describe assembly and disassembly sequences, chemical reaction networks [141], Horn-clause inference, and the association rules of section 8.2.2.
10.2.5 Quality function deployment
The house of quality of section 5.2.6 relates customer requirements with importances to design parameters (engineering specifications) by relationship scores , and its roof records correlations between parameters [80, 82]. The classical evaluation computes the technical importance
|
| (10.5) |
and develops the parameters in decreasing order of . Abonyi and Czvetkó [3] pointed out that this ranking ignores costs and the fact that parameters act in combination, and proposed three complementary formulations.
Mixed-integer selection. With a binary decision for every parameter, the roof spreads the effect of a developed parameter to its correlated ones, (with ), and the satisfaction of requirement is . The selection maximizes the total satisfaction under a budget and a limit on the number of parameters,
|
| (10.6) |
or minimizes the cost subject to minimum satisfaction levels.
Minimum-cost assignment. A flow network source parameters requirements sink, with capacity 1 and cost on the arc into parameter , an arc from to whenever , and demand (default 1) at requirement , selects the cheapest set of parameters that serves every requirement, each parameter serving one requirement. The model guarantees coverage but treats requirement and parameter in pairs: it cannot reward a parameter that serves several requirements at once.
The hypergraph view. With the requirements as vertices and the parameters as hyperedges (eq. (5.6)), the parameters can be ranked by a hyperedge centrality such as the node–edge eigenvector centrality of section 6.2.5, which rewards a parameter for serving important requirements that are also served by other important parameters, i.e. for its role in the group structure of the house of quality. Abonyi and Czvetkó also defined a generalized hypergraph whose hyperedges may contain other hyperedges: the hyperedge of parameter contains the requirements it influences and the parameters it is correlated with, so that direct and indirect effects can be analyzed in one incidence matrix of size .
In a nutshell: Combinatorial problems on hypergraphs
- Set cover (10.1) and hitting set (10.2) are dual (hitting set of = set cover of ); exact by integer programming (HiGHS), greedy within of the optimum.
- Minimal transversals by Berge’s algorithm (10.3); for simple ; output-sensitive complexity.
- Matching (disjoint groups), weak and strong coloring, Property B (NP-complete).
- -acyclicity by GYO reduction; join tree = maximum spanning tree of the intersection graph iff acyclic; efficient joins; conformality and Helly property.
- Directed hypergraphs: B-reachability (linear), minimum hyperpaths with sum or max cost (10.4).
- QFD: technical importance (10.5), MILP selection (10.6), min-cost assignment, hypergraph centrality, generalized hypergraph with correlations.
10.3 Using it in hatvis
problems.hitting_set(H, costs=None)
- Returns
-
a minimum-cost hitting set (list of vertices) by integer programming.
- Related
-
greedy_hitting_set, set_cover(H, universe, costs), greedy_set_cover, minimal_transversals(H, max_size), transversal_hypergraph, maximum_matching(H, weighted), greedy_coloring(H, strong), is_two_colorable, gyo_reduction, is_alpha_acyclic, join_tree, is_conformal, has_helly_property, b_reachable(D, sources), shortest_hyperpaths(D, sources, cost="sum"|"max").
qfd.qfd_select(relationship, costs, correlation=None, requirement=None, budget=None, max_actions=None, objective="max_satisfaction")
- Returns
-
a table with the decision, cost, and contribution of every parameter; .attrs holds the total satisfaction, the total cost, and the satisfaction vector.
- Related
-
qfd_min_cost_assignment(relationship, costs, demand), technical_importance, qfd_hypergraph, correlation_hypergraph, generalized_qfd_hypergraph, plot_house_of_quality.
10.4 Examples
Minimal monitoring sets. The physical resources of the wire-harness space (operators, robots, the AGV, and the crimping machines) are restricted to the activities in which they take part, and two questions are asked: which resources must carry a sensor so that every activity involves a monitored resource (a hitting set), and which activities must be observed so that every resource is seen (a set cover).
hs_exact = problems.hitting_set(people) hs_greedy = problems.greedy_hitting_set(people) sc_exact = problems.set_cover(people) sc_greedy = problems.greedy_set_cover(people)
The minimum hitting set has nine resources: six operators (–), the robots and , and the AGV (fig. 10.2); the greedy rule also finds nine. Every member of this set is forced: each of them is the only physical resource of at least one activity (the AGV of the six transport steps, each operator of a manual handling or assembly step, and and of the handling steps into the stations they operate), so any hitting set must contain them, and together they already meet every activity. The operator is not needed, because every activity of also involves the AGV. The minimum set cover needs nine activities, the greedy one ten, within Chvátal’s bound. Restricted to the first crimping and assembly stations of line 1, the subsystem has exactly two minimal transversals, and : the assembly operator must be monitored in any case, and the crimping station can be monitored either at its machine or at its operator. Read as failure sets, these are also the two minimal combinations of failures that would stop every activity of the subsystem.
Open in ColabExample plot_31_sensor_placement.py in the gallery
Acyclic schemas and join trees. A small order-processing schema with four tables is a hypergraph whose hyperedges are the tables and whose vertices are the attributes.
schema = hv.Hypergraph({"Orders": ["order", "customer", "date"], "Lines": ["order", "item", "qty"], "Items": ["item", "supplier", "price"], "Customers": ["customer", "city"]}) cycle = hv.Hypergraph({"R": ["a", "b"], "S": ["b", "c"], "T": ["a", "c"]}) for H in (schema, cycle): ok, steps = problems.gyo_reduction(H) print(f"alpha-acyclic: {ok}; first steps: {steps[:4]}") tree = problems.join_tree(schema)
The GYO reduction starts by deleting the ear attributes date, qty, supplier, and price, each of which occurs in a single table, then removes the tables that have become subsets of others, and continues until nothing is left: the schema is -acyclic. The join tree links Customers–Orders through customer, Orders–Lines through order, and Lines–Items through item (fig. 10.3); every attribute occurs in a connected part of the tree, so the four tables can be joined by three semijoin passes along it. The three tables , , , in contrast, have no ear vertex and no contained table; the reduction stops immediately, and the 3-cycle is the smallest cyclic schema.
Assembly feasibility and cost. The wire-harness process is reduced to eight steps, each a hyperarc from its input parts to its output: cutting wires, crimping a cut wire with a terminal, mounting a seal in a housing to obtain a connector, inserting the crimped wire into the connector, taping, routing on a jig, and testing; the finished harness can alternatively be bought from a supplier. The weights are the step durations.
D = hv.DirectedHypergraph({ "cut wires": (["wire"], ["cut wire"]), "crimp": (["cut wire", "terminal"], ["crimped wire"]), "mount housing": (["housing", "seal"], ["connector"]), "insert": (["crimped wire", "connector"], ["sub-harness"]), "tape": (["sub-harness", "tape"], ["taped sub-harness"]), "route": (["taped sub-harness", "jig"], ["harness"]), "buy harness": (["supplier"], ["harness"]), "test": (["harness", "tester"], ["tested harness"]), }, weights=[2, 3, 3, 4, 2, 5, 30, 3]) available = ["wire", "terminal", "housing", "seal", "tape", "jig", "tester"] print("producible:", sorted(problems.b_reachable(D, available) - set(available))) cost = pd.DataFrame({"sum": problems.shortest_hyperpaths(D, available, "sum"), "max": problems.shortest_hyperpaths(D, available, "max")})
From the available parts all intermediate and final products are B-reachable, but the supplier is not available, so the purchase arc never fires. The minimum hyperpath costs of fig. 10.4 distinguish total effort and makespan. The sub-harness needs 12 time units of work in total (cutting 2, crimping 3, mounting 3, inserting 4), but only 9 if the connector is mounted while the wire is cut and crimped; the tested harness needs 22 units of work and can be completed in 19. The difference is exactly the parallelism of the AND-dependency, which a path in a graph cannot express: in a graph, reaching the sub-harness through the crimped wire would ignore that the connector must also be there.
Open in ColabExample plot_33_directed_assembly.py in the gallery
Which specifications should be developed? The three QFD formulations are applied to the electric-car house of quality of section 5.4 with illustrative development costs (4, 3, 3, 2, 3, 4, 1, 1, 2, 1, 1 for ES1–ES11); the satisfaction of a selection is measured, for comparability, as the sum of its relationship scores.
lp = hv.qfd.qfd_select(R, costs=costs, budget=12, max_actions=6) flow = hv.qfd.qfd_min_cost_assignment(R, costs=costs) _, edge_c = hv.node_edge_eigenvector(q.hypergraph, "linear") n_lp = int(lp["selected"].sum()) # as many as the LP selected hyper = edge_c.sort_values(ascending=False).index[:n_lp]
| Model | selected specifications | cost | score |
| MILP, budget 12, at most 6 | ES4, ES5, ES6, ES7, ES10, ES11 | 12 | 101 |
| min-cost assignment | ES1, ES4, ES5, ES7, ES8, ES9, ES10, ES11 | 15 | 117 |
| hypergraph centrality (top 6) | ES1, ES5, ES6, ES7, ES10, ES11 | 14 | 111 |
Table 10.1 shows how the models answer different questions. The technical importance (10.5) ranks sensors and algorithms first (103 each), followed by LiDAR (95) and GPS navigation (72), without regard to cost. The MILP spends the budget of 12 on the cheap and broadly useful specifications: the vehicle classification, airbags, and the restraint system cost 1 each, grid charging 2, and sensors and algorithms take the rest; LiDAR does not fit. The min-cost assignment must give every requirement its own specification and therefore buys eight, including the number of seats for boot space and the brakes for the braking requirement, at cost 15; it covers every requirement with a dedicated specification, which the MILP does not guarantee. The hypergraph centrality ranks LiDAR, sensors, and algorithms highest because they jointly serve the two most important requirements, and its top six reach a score of 111 at cost 14, more than the MILP but over its budget. None of the three is “the” answer: the MILP is the right tool when the budget is fixed, the assignment when every requirement must have an owner, and the hypergraph view when the question is which specifications form the core of the design. Figure 10.5 shows the house of quality drawn by hatvis with an illustrative roof.
Open in ColabExample plot_34_qfd_optimization.py in the gallery
10.5 Further reading
Berge [16] covers transversals, matchings, colorings, and the Helly property; Chvátal [130] analyzes the greedy set cover, and Eiter and Gottlob [131] and Fredman and Khachiyan [132] the enumeration of minimal transversals. Beeri et al. [138], Fagin [140], and Tarjan and Yannakakis [135] are the classical references on acyclic hypergraphs, and Maier [137] treats join trees in the context of relational databases. Gallo et al. [33] introduce directed hypergraphs, B-reachability, and hyperpaths, and Ausiello and Laura [34] survey the algorithms. The hypergraph and network-flow formulations of QFD are developed in [3]; Chan and Wu [81] review the QFD literature.