Logic Guided Genetic Algorithms

Dhananjay Ashok, Joseph Scott, Sebastian Johann Wetzel, Maysum Panju, Vijay GanesharXiv 2020

Abstract

Logic Guided Genetic Algorithms (LGGA) address the fundamental challenges of overfitting and data inefficiency in symbolic regression by integrating "Auxiliary Truths"—prior mathematical knowledge such as symmetry or boundary conditions—into the learning process. By penalizing logically inconsistent candidate equations and generating adversarial data points through a corrective feedback loop, LGGA improves data efficiency by over 60% and enables the discovery of complex physical laws that standard algorithms fail to identify.

Introduction: The Challenge of Symbolic Regression

Symbolic Regression (SR) is often considered the "holy grail" of data-driven science. Unlike deep learning models that function as "black boxes," SR aims to discover the exact mathematical formulas (e.g., $F = ma$) that govern physical systems. However, SR is an NP-hard problem. Standard Genetic Algorithms (GAs) frequently suffer from two major drawbacks:

  1. Overfitting: With limited data, GAs often produce complex, high-degree polynomials that fit training points perfectly but lack physical validity.
  2. Data Inefficiency: They typically require vast amounts of labeled data to converge on the correct functional form.

LGGA bridges the gap between machine learning and mathematical logic by incorporating domain knowledge into the search process, mimicking how humans use prior intuition to solve problems.

Methods: The LGGA Feedback Loop

The LGGA framework modifies the standard Genetic Algorithm loop through two primary mechanisms:

  1. Auxiliary Truth (AT) Enhanced Loss: Beyond measuring Mean Squared Error (MSE), the algorithm calculates a "Truth Error." If a candidate equation violates a known property—such as symmetry ($f(x,y) = f(y,x)$)—it receives a heavy penalty, effectively pruning the search space of logically impossible solutions.
  2. Corrective Feedback Loop: If a candidate equation fits the current data but violates an Auxiliary Truth, the system generates a "counterexample." For instance, if the truth is $f(0, x) = 0$ and the candidate predicts $f(0, 5) = 12$, the point $(0, 5, 0)$ is added to the training set, forcing the algorithm to correct its logic in subsequent generations.
The LGGA Feedback Loop architecture, showing how Auxiliary Truths guide both the genetic search and data generation.

Datasets and Evaluation

The researchers evaluated LGGA using 16 physics equations sourced from the Feynman Lectures on Physics, covering classical mechanics, electromagnetism, and thermodynamics. They benchmarked LGGA-enhanced versions of industry-standard SR tools, including Eureqa, TuringBot, and AI Feynman 2.0.

Key Results

The integration of logic-guided search yielded significant performance gains across all benchmarks:

  • Solving the Unsolvable: LGGA enabled standard GAs to solve 5 out of 16 Feynman equations that were previously unsolvable by the "classic" versions. As shown in the results table, several equations (marked "NoDisc") were only discovered when LGGA was employed.
  • Massive Data Efficiency: When paired with industrial tools, LGGA reduced the amount of data required by up to 61.9%. In many cases, the number of data points needed to find the correct equation dropped by an order of magnitude.
  • Robustness: For complex equations like the Normal distribution or Reflection formulas, industrial tools only successfully converged on the correct answer when augmented with LGGA's logic-driven data.
Comparison of minimum data points needed for Eureqa and TuringBot with and without LGGA enhancement.

Discussion and Future Work

LGGA demonstrates that logic is a powerful guide for machine learning. By penalizing "illogical" expressions early, the algorithm spends more time exploring physically plausible regions of the expression space. Furthermore, data augmentation via ATs provides "zero-cost" data, as mathematical certainties like symmetry allow for the generation of valid new data points without expensive experimental trials.

Future work aims to address the current requirement for manually provided "prior knowledge" and explore the integration of formal verification tools, such as SMT solvers, to mathematically prove that candidate equations satisfy all constraints across their entire domain.

Summary updated

BibTeX
@misc{ashok2020logic,
  author = {Dhananjay Ashok and Joseph Scott and Sebastian Johann Wetzel and Maysum Panju and Vijay Ganesh},
  title = {{Logic Guided Genetic Algorithms}},
  year = {2020},
  eprint = {2010.11328},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2010.11328},
}
Figure