Certainly! Your problem is a combinatorial optimization problem over the space of directed graphs on ( n ) nodes, with a black-box (costly) objective function (the "score"). The search space is enormous: for ( n ) nodes, there are ( 2^{n(n-1)} ) possible directed graphs (since each of the ( n(n-1) ) possible directed edges can be present or absent independently).
Given the constraints:
- n is moderate (7–25), but the search space is still astronomically large for exhaustive search.
- Score evaluation is expensive, especially for dense graphs.
- You seek the best (or near-best) graph for a fixed ( n ).
Let’s analyze the best approaches.
1. Why Not Exhaustive Search?
For ( n = 10 ), there are ( 2^{90} \approx 1.2 \times 10^{27} ) graphs. For ( n = 20 ), ( 2^{380} ) is incomprehensibly large. Exhaustive search is infeasible.
2. Why Not Simple Greedy or Hill Climbing?
- Greedy algorithms (e.g., adding the best edge at each step) are likely to get stuck in poor local optima, especially in high-dimensional, rugged search spaces like graphs.
- Hill climbing (local search) can be improved with random restarts, but still struggles with local optima and plateaus.
3. Metaheuristics: The Standard Approach
For problems like this, metaheuristic algorithms are the standard and most practical approach. The most common and effective ones for graph optimization are:
a. Simulated Annealing (SA)
- How it works: Randomly perturb the current graph (e.g., add/remove/reverse an edge), accept changes that improve the score, and sometimes accept worse solutions to escape local optima, with probability decreasing over time ("cooling").
- Why it's good here: SA is simple, robust, and can be tuned to balance exploration and exploitation. It is especially effective when each evaluation is expensive, as it makes good use of each evaluation.
- Graph moves: You can define moves as adding, removing, or reversing a single edge, or more complex moves (e.g., edge swaps).
b. Genetic Algorithms (GA) / Evolutionary Algorithms
- How it works: Maintain a population of graphs, select the best, recombine (crossover), and mutate to create new graphs.
- Why it's good here: GAs can explore a diverse set of solutions and are less likely to get stuck in local optima. However, they require more score evaluations per iteration (one per individual in the population), which may be costly in your case.
- Graph encoding: Each graph can be encoded as an adjacency matrix or edge list.
c. Tabu Search
- How it works: Like local search, but keeps a "tabu list" of recently visited solutions to avoid cycling.
- Why it's good here: Can escape local optima and is more memory-efficient than GAs.
4. Specialized Approaches
If you have domain-specific knowledge (e.g., constraints on the graph, known good substructures, or symmetries), you can incorporate this into your search to prune the space or bias the search.
5. Efficiency Considerations
Given that score evaluation is expensive, you want an algorithm that:
- Minimizes the number of evaluations (i.e., makes each evaluation count).
- Can exploit partial evaluations (e.g., if you can incrementally update the score when only a small part of the graph changes).
- Can be parallelized (e.g., evaluating multiple candidate graphs in parallel, if resources allow).
6. Best Practice Recommendation
Simulated Annealing (SA) is the most common and effective approach for this scenario.
Justification:
- Efficient use of evaluations: Each step only requires one new score evaluation.
- Good convergence: With a well-chosen cooling schedule, SA can escape local optima and converge to high-quality solutions.
- Flexible: Easy to implement for graphs, and you can tailor the neighborhood structure to your problem (e.g., only consider sparse graphs if dense ones are too costly).
- Widely used: SA is a standard tool in combinatorial optimization, especially for graph problems (see applications in network design, Bayesian network structure learning, etc.).
Implementation Tips:
- Start from a reasonable initial graph (e.g., empty, random, or based on heuristics).
- Define a neighborhood: Add, remove, or reverse a single edge per move.
- Cooling schedule: Exponential or logarithmic cooling is common.
- Early stopping: If no improvement after many steps, stop early.
- Parallelism: If possible, evaluate multiple neighbors in parallel.
7. Advanced: Surrogate Models / Bayesian Optimization
If score evaluations are extremely expensive, you might consider Bayesian Optimization or surrogate-assisted optimization. Here, you build a statistical model (e.g., Gaussian Process) of the score function and use it to guide the search. This is more complex to implement for combinatorial spaces like graphs, but recent research (see "Bayesian Optimization of Combinatorial Structures") has made progress in this area.
Summary Table
| Approach | Pros | Cons | Suitability |
|---|
| Exhaustive Search | Finds global optimum | Infeasible for ( n \geq 7 ) | ✗ |
| Greedy/Local Search | Simple, fast | Stuck in local optima | △ |
| Simulated Annealing | Escapes local optima, efficient | Needs tuning, stochastic | ✓ |
| Genetic Algorithms | Explores diverse solutions | More evaluations per iteration | ✓ |
| Tabu Search | Avoids cycles, escapes local optima | Needs memory, parameter tuning | ✓ |
| Bayesian Optimization | Minimizes evaluations | Complex, less mature for graphs | △ |
References
- Kirkpatrick, S., Gelatt, C. D., & Vecchi, M. P. (1983). Optimization by Simulated Annealing. Science, 220(4598), 671-680.
- Russell, S., & Norvig, P. (2020). Artificial Intelligence: A Modern Approach (4th ed.), Ch. 4, 5, 6.
- Frazier, P. I. (2018). A Tutorial on Bayesian Optimization. arXiv:1807.02811.
- Cussens, J. (2011). Bayesian network learning with cutting planes. UAI.
Conclusion
Simulated Annealing is the most practical and widely used approach for your problem: it balances exploration and exploitation, is efficient with expensive evaluations, and is easy to implement for directed graphs. If you have the resources and need even fewer evaluations, consider surrogate-assisted methods, but for most practical purposes, SA is the standard and recommended method.
If you have more information about the structure of your score function or constraints on the graphs, further tailoring is possible. Let me know if you want details on implementation or references to similar problems in the literature!