# Ewolucyjne ulepszanie i naprawa istniejącego kodu

EN: **Genetic improvement and automated program repair** · id `geneticimprovement` · aliases: genetic improvement, GI, automated program repair, APR, automatyczna naprawa programów, ulepszanie genetyczne

Path: [AI Atlas](https://aiatlasgraph.com/llms.txt) › [Obliczenia ewolucyjne i inteligencja roju](https://aiatlasgraph.com/t/evolutionary.md) › [Klasyczne algorytmy ewolucyjne](https://aiatlasgraph.com/t/evoclassic.md) › [Programowanie genetyczne i regresja symboliczna](https://aiatlasgraph.com/t/geneticprogramming.md) › Ewolucyjne ulepszanie i naprawa istniejącego kodu

## Description

- PL: Przeszukiwanie, zwykle programowaniem genetycznym, przestrzeni edycji istniejącego kodu w celu naprawy błędów lub poprawy wydajności.
- EN: Search, usually by genetic programming, over edits to existing code to repair bugs or improve performance.

## In one sentence

- PL: Program bierze istniejący kod, wprowadza w nim drobne zmiany i zachowuje te, po których kod naprawia błąd albo działa szybciej.
- EN: Software takes existing code, makes small edits and keeps those that fix a bug or make it run faster.

## Problem it solves

- PL: Naprawianie błędów i przyspieszanie dużych programów zjada mnóstwo czasu programistów, a zgłoszeń przybywa szybciej niż rąk do pracy.
- EN: Fixing bugs and speeding up large programs eats huge amounts of developer time, and reports pile up faster than people can handle.

## What it does

- PL: Zamiast pisać od zera, przestawia, usuwa i kopiuje gotowe linijki z tego samego programu, a testy rozstrzygają, która wersja jest lepsza.
- EN: Rather than writing from scratch, it moves, deletes and copies existing lines from the same program, and tests decide which version wins.

## Everyday example

- PL: Rano programista znajduje propozycję poprawki: nocny proces wypróbował setki drobnych zmian i jedna przeszła wszystkie testy, łącznie z tym, który wcześniej padał.
- EN: In the morning a developer finds a suggested fix: an overnight job tried hundreds of small edits, and one passed every test, including the one that failed.

## This concerns you if you…

- PL: utrzymujesz duży kod z dobrym zestawem testów
- PL: szukasz sposobu na tańsze poprawki błędów
- EN: maintain a large codebase with a good test suite
- EN: look for cheaper bug fixes

## Keywords

GenProg · automated program repair · fault localization · Defects4J · ManyBugs · PyGGI · Gin · patch overfitting · delta debugging

## How it works

- PL: Kandydat to lista edycji drzewa składni: usunięcie, wstawienie lub zamiana instrukcji, często skopiowanych z innego miejsca programu. Lokalizacja błędu kieruje mutacje na linie wykonywane przez test, który pada. Przystosowanie to ważona liczba zaliczonych testów; zwycięską łatkę minimalizuje się, usuwając zbędne zmiany.
- EN: A candidate is a list of syntax-tree edits: deleting, inserting or swapping statements, often copied from elsewhere in the program. Fault localisation steers mutations to lines run by the failing test. Fitness is the weighted count of passing tests; the winning patch is minimised by dropping unneeded edits.

## Limits

- PL: Jakość zależy od testów: przy słabym zestawie łatka może po prostu usunąć funkcję. Trudno naprawić błędy niedeterministyczne i takie, których poprawka nie istnieje w kodzie. Wymaga wielu kompilacji i uruchomień testów.
- EN: Quality depends on tests: with a weak suite a patch may simply delete a feature. Nondeterministic bugs and fixes not present elsewhere in the code are hard. It needs many builds and test runs.

## Key terms

- PL: **lokalizacja błędu**: Wskazanie linii kodu najbardziej podejrzanych o spowodowanie błędu.
- PL: **przeuczona łatka**: Zmiana, która zalicza testy, ale nie naprawia prawdziwego problemu.
- PL: **drzewo składni (AST)**: Struktura programu jako drzewo instrukcji i wyrażeń.
- EN: **fault localisation**: Pointing to the code lines most likely to cause the bug.
- EN: **overfitted patch**: An edit that passes tests but does not fix the real problem.
- EN: **abstract syntax tree (AST)**: A program's structure as a tree of statements and expressions.

## Know first

- [Agenci kodujący (AI-assisted coding)](https://aiatlasgraph.com/t/aicoding.md)

## Sources

- [GenProg: A Generic Method for Automatic Software Repair](<https://clairelegoues.com/assets/papers/genprog12tse.pdf>) `genprog-tse-2012` · by Claire Le Goues, ThanhVu Nguyen, Stephanie Forrest, Westley Weimer

---

AI Atlas revision 124 (2026-10-31) · HTML: https://aiatlasgraph.com/t/geneticimprovement · index: https://aiatlasgraph.com/llms.txt · everything: https://aiatlasgraph.com/llms-full.txt · updated 2026-10-30
