{"id":27778,"library":"ga-vqc","title":"Genetic Algorithm for VQC ansatz search","description":"GA-VQC provides a genetic algorithm to automatically search for optimal variational quantum circuit (VQC) ansätze for quantum machine learning tasks. Version 1.0.14 is the latest; development appears to be active on GitHub.","status":"active","version":"1.0.14","language":"python","source_language":"en","source_url":"https://github.com/tcoulvert/GA_Ansatz_Search","tags":["quantum computing","genetic algorithm","VQC","ansatz search","quantum machine learning"],"install":[{"cmd":"pip install ga-vqc","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Numerical operations","package":"numpy","optional":false},{"reason":"Machine learning utilities","package":"scikit-learn","optional":false},{"reason":"Quantum computing backend","package":"qiskit","optional":false}],"imports":[{"note":"Module name uses lowercase 'gavqc', not hyphen or underscore.","wrong":"from ga_vqc import GenAlg","symbol":"GenAlg","correct":"from gavqc import GenAlg"},{"note":"VQCAnsatz is exported from top-level gavqc.","wrong":"from ga_vqc.ansatz import VQCAnsatz","symbol":"VQCAnsatz","correct":"from gavqc import VQCAnsatz"}],"quickstart":{"code":"from gavqc import GenAlg\nfrom qiskit.circuit import QuantumCircuit\nfrom qiskit.circuit.library import RealAmplitudes\nimport numpy as np\n\n# Example: optimize a simple circuit structure\nansatz = RealAmplitudes(2, reps=1)\nX = np.random.rand(10, 2)\ny = np.random.randint(0, 2, 10)\n\nga = GenAlg(\n    ansatz=ansatz,\n    X=X, y=y,\n    generations=10,\n    population_size=10,\n    mutation_rate=0.1\n)\nga.run()\nprint(\"Best fitness:\", ga.best_fitness)\nprint(\"Best circuit:\", ga.best_circuit)","lang":"python","description":"Minimal example to run genetic algorithm for VQC ansatz search."},"warnings":[{"fix":"Use 'from gavqc import ...' instead of 'import ga_vqc'.","message":"Import path changed: module name is 'gavqc' (not 'ga_vqc' or 'ga-vqc').","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Access results via the GenAlg instance after calling run().","message":"GenAlg.run() modifies the instance; best circuit stored in GenAlg.best_circuit attribute.","severity":"gotcha","affected_versions":"all"},{"fix":"Upgrade to Qiskit 0.45+.","message":"Support for Qiskit <0.45 is dropped.","severity":"deprecated","affected_versions":">=1.0.10"}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"fix":"Use: from gavqc import GenAlg","cause":"Incorrect import path; correct module name is 'gavqc'.","error":"ModuleNotFoundError: No module named 'ga_vqc'"},{"fix":"Ensure you are using the latest version (pip install --upgrade ga-vqc). The current API accepts 'X' and 'y'.","cause":"GenAlg expects 'X' and 'y' as positional or keyword arguments, but older versions used different parameter names.","error":"TypeError: __init__() got an unexpected keyword argument 'X'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}