VLCDA


NameVLCDA JSON
Version 1.0.11 PyPI version JSON
download
home_pagehttps://github.com/HumbertoTavora/Logic-Circuits-Evolution
SummaryPython module dedicated to the evolution of logic circuits through genetic algorithms
upload_time2024-04-11 04:48:53
maintainerNone
docs_urlNone
authorHumberto Távora, Stefan Blawid, Yasmin Maria
requires_pythonNone
licenseMIT
keywords genetic algorithm logic circuits evolution optimization
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            VLCDA
## Virtual Logic Circuits Design Automation

Python module dedicated to the evolution of logic circuits through genetic algorithms

- Evolving Combinational Logic Circuits through genetic algorithm
- A set of Odd Parity Generetors evolveds until the 100% Fitness 


> To exploit the true potential of emerging nanotechnologies, automation of the
> electronic design (EDA) of digital systems must be rethought. The digital projects
> for the nanoelectronic age it must be immune to defects and accept variability. curiosity-
> Mind you, these are characteristics of biological systems shaped by evolution. algorithms
> genetics can be used for the synthesis of digital systems when hard-
> fully integrated ware, such as those imposed by programmable devices.
> It has even been pointed out that as digital circuits evolve, fault handling strategies
> recognized by evolution reappear naturally.


## Installation

VEDA module requires [Python 3](https://www.python.org/) and some basics modules to run. 

- Random
- Datetime
- Bisect

If you don't have theses modules, run the following commands:

```sh
pip install random
pip install datetime
pip install bisect
```

To install the module VEDA run the following commands...

```sh
pip install VLCDA
```
Be sure to maintain pip updated ...
```sh
pip install --upgrade VLCDA
```

## Class `Genoma`

The `Genoma` class represents an individual genome in the genetic algorithm.

#### Method `__init__(self, numberOfGenes, nInputs, nOutputs)`

- `numberOfGenes`: The number of genes in the genome.
- `nInputs`: The number of inputs.
- `nOutputs`: The number of outputs.

#### Method `generate_parent(self)`

Generates a random parent genome.

#### Method `mutate(self)`

Applies mutation to the genome.

#### Method `copyGene(self, childGenome)`

Copies the genes from the current genome to another genome.

#### Method `calculateFitness(self, logicFunction)`

Calculates the fitness of the genome based on a specified logic function.

#### Method `calculateNoiseFitness(self)`

Calculates the noise fitness of the genome.

#### Method `setFaultChance(self)`

Sets the fault chance for the genome.

#### Method `setFitness(self, fitness)`

Sets the fitness of the genome.

#### Method `setGenotipo(self, a)`

Sets the genotype of the genome.

#### Method `getGenotypeActiveZone(self)`

Returns the genes in the active zone of the genotype.

#### Method `getGenotypeDeadZone(self)`

Returns the genes in the dead zone of the genotype.

#### Method `identify_deadGenes(self)`

Identifies the dead genes in the genome. It is used in others methods to optimize some of the evolution steps.



## Class `GeneticAlgorithm`

The `GeneticAlgorithm` class implements a genetic algorithm to evolve genomes towards a desired solution.

#### Method `__init__(self, y=10, maxGeneration=4000000)`

- `y`: The number of children generated per generation.
- `maxGeneration`: The maximum number of generations allowed.

#### Method `display(self, guess, fitness, noiseFitness, totalGeneration)`

Displays information about the current generation, including genotype, fitness, noise fitness, and the total number of generations. It will be shown every 1000 generation.

#### Method `addToFitnessList(self, childFitness)`

Adds choosen fitness off the generation to the fitness list, ensuring sorting (Will be usefull to plots in future methods).

#### Method `showBarPlot(self, genome_id, samplingLen)`

Displays a bar plot representing the frequency distribution of fitnesses in the population.

#### Method `getBestGenomeWithSize(self, listChild)`

Returns the genome with the best fitness and shortest genome size in a list of children.

#### Method `getBestGenome(self, listChild)`

Returns the genome with the best fitness in a list of children.

#### Method `evolution(self, genome, logicFunction)`

It performs the process of evolution of the genetic algorithm. This includes generating the `y` children, mutation, selecting the best genomes, and displaying progress information.

This class is used to evolve genomes toward an optimal solution by applying mutations and natural selection over several generations until a stop criterion is reached or the desired solution is found. The logical function needs to be provided, or one of the module's implementations can be used.

## Usage
Lets see an example of how to evolving an Parity Generator with de VLCDA module.

1. Install the required dependencies (e.g., `from VLCDA import Logic_Circuits_Evolution as LCE`).
2. Set the parameters for the genetic algorithm:
    - `nGenes`: Number of genes in each genome.
    - `nOutputs`: Number of output nodes.
    - `nInputs`: Number of input nodes.
3. Create an initial genome:
    ```python
    nGenes = 60
    nOutputs = 1
    nInputs = 4
    genome = LCE.Genoma(nGenes, nInputs, nOutputs)
    ```
4. Initialize the genetic algorithm:
    ```python
    geneticAlgorithm = LCE.GeneticAlgorithm()
    ```
5. Evolve the genome using the `gpinand` function:
    ```python
    geneticAlgorithm.evolution(genome, genome.gpinand)
    ```

To see the evolveds odd parity generetor sample (PG1 to PG9), you can do the following:

1. Install the required dependencies (e.g., `from VLCDA import PGs_Collection as PGs`).

2. Initialize the genetic algorithm:
    ```python
    PGs.PG_collection["PG1"]
    ```

## License

MIT


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/HumbertoTavora/Logic-Circuits-Evolution",
    "name": "VLCDA",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "Genetic, Algorithm, Logic Circuits, Evolution, Optimization",
    "author": "Humberto T\u00e1vora, Stefan Blawid, Yasmin Maria",
    "author_email": "humbertocctg@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/71/b7/a0824e37209c988feb2da63f09c4cc9947379ce3b608b1f04130a4ca7b88/VLCDA-1.0.11.tar.gz",
    "platform": null,
    "description": "VLCDA\r\n## Virtual Logic Circuits Design Automation\r\n\r\nPython module dedicated to the evolution of logic circuits through genetic algorithms\r\n\r\n- Evolving Combinational Logic Circuits through genetic algorithm\r\n- A set of Odd Parity Generetors evolveds until the 100% Fitness \r\n\r\n\r\n> To exploit the true potential of emerging nanotechnologies, automation of the\r\n> electronic design (EDA) of digital systems must be rethought. The digital projects\r\n> for the nanoelectronic age it must be immune to defects and accept variability. curiosity-\r\n> Mind you, these are characteristics of biological systems shaped by evolution. algorithms\r\n> genetics can be used for the synthesis of digital systems when hard-\r\n> fully integrated ware, such as those imposed by programmable devices.\r\n> It has even been pointed out that as digital circuits evolve, fault handling strategies\r\n> recognized by evolution reappear naturally.\r\n\r\n\r\n## Installation\r\n\r\nVEDA module requires [Python 3](https://www.python.org/) and some basics modules to run. \r\n\r\n- Random\r\n- Datetime\r\n- Bisect\r\n\r\nIf you don't have theses modules, run the following commands:\r\n\r\n```sh\r\npip install random\r\npip install datetime\r\npip install bisect\r\n```\r\n\r\nTo install the module VEDA run the following commands...\r\n\r\n```sh\r\npip install VLCDA\r\n```\r\nBe sure to maintain pip updated ...\r\n```sh\r\npip install --upgrade VLCDA\r\n```\r\n\r\n## Class `Genoma`\r\n\r\nThe `Genoma` class represents an individual genome in the genetic algorithm.\r\n\r\n#### Method `__init__(self, numberOfGenes, nInputs, nOutputs)`\r\n\r\n- `numberOfGenes`: The number of genes in the genome.\r\n- `nInputs`: The number of inputs.\r\n- `nOutputs`: The number of outputs.\r\n\r\n#### Method `generate_parent(self)`\r\n\r\nGenerates a random parent genome.\r\n\r\n#### Method `mutate(self)`\r\n\r\nApplies mutation to the genome.\r\n\r\n#### Method `copyGene(self, childGenome)`\r\n\r\nCopies the genes from the current genome to another genome.\r\n\r\n#### Method `calculateFitness(self, logicFunction)`\r\n\r\nCalculates the fitness of the genome based on a specified logic function.\r\n\r\n#### Method `calculateNoiseFitness(self)`\r\n\r\nCalculates the noise fitness of the genome.\r\n\r\n#### Method `setFaultChance(self)`\r\n\r\nSets the fault chance for the genome.\r\n\r\n#### Method `setFitness(self, fitness)`\r\n\r\nSets the fitness of the genome.\r\n\r\n#### Method `setGenotipo(self, a)`\r\n\r\nSets the genotype of the genome.\r\n\r\n#### Method `getGenotypeActiveZone(self)`\r\n\r\nReturns the genes in the active zone of the genotype.\r\n\r\n#### Method `getGenotypeDeadZone(self)`\r\n\r\nReturns the genes in the dead zone of the genotype.\r\n\r\n#### Method `identify_deadGenes(self)`\r\n\r\nIdentifies the dead genes in the genome. It is used in others methods to optimize some of the evolution steps.\r\n\r\n\r\n\r\n## Class `GeneticAlgorithm`\r\n\r\nThe `GeneticAlgorithm` class implements a genetic algorithm to evolve genomes towards a desired solution.\r\n\r\n#### Method `__init__(self, y=10, maxGeneration=4000000)`\r\n\r\n- `y`: The number of children generated per generation.\r\n- `maxGeneration`: The maximum number of generations allowed.\r\n\r\n#### Method `display(self, guess, fitness, noiseFitness, totalGeneration)`\r\n\r\nDisplays information about the current generation, including genotype, fitness, noise fitness, and the total number of generations. It will be shown every 1000 generation.\r\n\r\n#### Method `addToFitnessList(self, childFitness)`\r\n\r\nAdds choosen fitness off the generation to the fitness list, ensuring sorting (Will be usefull to plots in future methods).\r\n\r\n#### Method `showBarPlot(self, genome_id, samplingLen)`\r\n\r\nDisplays a bar plot representing the frequency distribution of fitnesses in the population.\r\n\r\n#### Method `getBestGenomeWithSize(self, listChild)`\r\n\r\nReturns the genome with the best fitness and shortest genome size in a list of children.\r\n\r\n#### Method `getBestGenome(self, listChild)`\r\n\r\nReturns the genome with the best fitness in a list of children.\r\n\r\n#### Method `evolution(self, genome, logicFunction)`\r\n\r\nIt performs the process of evolution of the genetic algorithm. This includes generating the `y` children, mutation, selecting the best genomes, and displaying progress information.\r\n\r\nThis class is used to evolve genomes toward an optimal solution by applying mutations and natural selection over several generations until a stop criterion is reached or the desired solution is found. The logical function needs to be provided, or one of the module's implementations can be used.\r\n\r\n## Usage\r\nLets see an example of how to evolving an Parity Generator with de VLCDA module.\r\n\r\n1. Install the required dependencies (e.g., `from VLCDA import Logic_Circuits_Evolution as LCE`).\r\n2. Set the parameters for the genetic algorithm:\r\n    - `nGenes`: Number of genes in each genome.\r\n    - `nOutputs`: Number of output nodes.\r\n    - `nInputs`: Number of input nodes.\r\n3. Create an initial genome:\r\n    ```python\r\n    nGenes = 60\r\n    nOutputs = 1\r\n    nInputs = 4\r\n    genome = LCE.Genoma(nGenes, nInputs, nOutputs)\r\n    ```\r\n4. Initialize the genetic algorithm:\r\n    ```python\r\n    geneticAlgorithm = LCE.GeneticAlgorithm()\r\n    ```\r\n5. Evolve the genome using the `gpinand` function:\r\n    ```python\r\n    geneticAlgorithm.evolution(genome, genome.gpinand)\r\n    ```\r\n\r\nTo see the evolveds odd parity generetor sample (PG1 to PG9), you can do the following:\r\n\r\n1. Install the required dependencies (e.g., `from VLCDA import PGs_Collection as PGs`).\r\n\r\n2. Initialize the genetic algorithm:\r\n    ```python\r\n    PGs.PG_collection[\"PG1\"]\r\n    ```\r\n\r\n## License\r\n\r\nMIT\r\n\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Python module dedicated to the evolution of logic circuits through genetic algorithms",
    "version": "1.0.11",
    "project_urls": {
        "Download": "https://github.com/HumbertoTavora/Logic-Circuits-Evolution",
        "Homepage": "https://github.com/HumbertoTavora/Logic-Circuits-Evolution"
    },
    "split_keywords": [
        "genetic",
        " algorithm",
        " logic circuits",
        " evolution",
        " optimization"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "71b7a0824e37209c988feb2da63f09c4cc9947379ce3b608b1f04130a4ca7b88",
                "md5": "ee35365f9b5344b31a80f791607adcb3",
                "sha256": "f137280dfedcc5462183058da03a843c1f37509c9fcd612f1a87a86e025d524e"
            },
            "downloads": -1,
            "filename": "VLCDA-1.0.11.tar.gz",
            "has_sig": false,
            "md5_digest": "ee35365f9b5344b31a80f791607adcb3",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 103083,
            "upload_time": "2024-04-11T04:48:53",
            "upload_time_iso_8601": "2024-04-11T04:48:53.980565Z",
            "url": "https://files.pythonhosted.org/packages/71/b7/a0824e37209c988feb2da63f09c4cc9947379ce3b608b1f04130a4ca7b88/VLCDA-1.0.11.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-11 04:48:53",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "HumbertoTavora",
    "github_project": "Logic-Circuits-Evolution",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "vlcda"
}
        
Elapsed time: 0.47677s