Mar-27-2018, 05:55 AM
I want to implement cocomo model using Genetic Algorithm for parameter tunning of a b c and d.
formula is Effort Applied (E) = a(KLOC)b [ man-months ].
formula is Effort Applied (E) = a(KLOC)b [ man-months ].
Genetic Algorithm
|
Mar-27-2018, 05:55 AM
I want to implement cocomo model using Genetic Algorithm for parameter tunning of a b c and d.
formula is Effort Applied (E) = a(KLOC)b [ man-months ].
Mar-27-2018, 06:13 AM
Sounds interesting project, not that I understand the subject. What have you tried? Post your code in python tags, full traceback in error tags in case you get exception. Ask specific questions. Given this may require very specific knowledge you may need to elaborate further on what your goal is.
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link Create MCV example Debug small programs
Mar-27-2018, 11:18 AM
Jan-24-2019, 10:07 AM
(This post was last modified: Jan-24-2019, 10:07 AM by rajeev1729.)
from math import sin, cos, pi from gaft import GAEngine from gaft.components import BinaryIndividual,decimal_individual from gaft.components import Population from gaft.operators import TournamentSelection from gaft.operators import UniformCrossover from gaft.operators import FlipBitBigMutation # Analysis plugin base class. from gaft.plugin_interfaces.analysis import OnTheFlyAnalysis # Built-in best fitness analysis. from gaft.analysis.fitness_store import FitnessStore from gaft.analysis.console_output import ConsoleOutput # Define population. indv_template = BinaryIndividual(ranges=[(0, 5), (0.1, 5),(-0.5, 2.5),(0, 25)], eps=0.001) #indv_template = decimal_individual((0, 5), (0.1, 5),(-0.5, 2.5),(0, 25)) population = Population(indv_template=indv_template, size=50).init() # Create genetic operators. #selection = RouletteWheelSelection() selection = TournamentSelection() crossover = UniformCrossover(pc=0.95, pe=0.5) mutation = FlipBitBigMutation(pm=0.01, pbm=0.55, alpha=0.6) # Create genetic algorithm engine. # Here we pass all built-in analysis to engine constructor. engine = GAEngine(population=population, selection=selection, crossover=crossover, mutation=mutation, analysis=[ConsoleOutput, FitnessStore]) # Define fitness function. def effort_applied(a,b,c,d, kloc, me): return a * (kloc ** b) + c * me + d import pandas as pd dataset = pd.read_csv('anil18.csv') kloc = dataset.iloc[:18, 0].values me= dataset.iloc[:18, 1].values target = dataset.iloc[:18, 2].values rows=len(kloc[:18]) mmre=[] vaf=[] @engine.fitness_register def fitness(indv): a,b,c,d = indv.solution Effort=[] for k in range(rows): E = effort_applied(a,b,c,d, kloc[k], me[k]) Effort.append(E) dif = [] for i in range(rows): dd = abs(target[i] - Effort[i]) / target[i] dif.append(dd) mmre.append(sum(dif) / 18) return float(min(mmre)) from statistics import variance d = [] for i in range(18): a = (target[i] - Effort[i]) d.append(a) vd=variance(d) vy=variance(target[:18]) va=(1-vd/vy)*100 vaf.append(va) # print(y[:18]) return float(max(vaf)) if '__main__' == __name__: engine.run(ng=500) |
|
Possibly Related Threads… | |||||
Thread | Author | Replies | Views | Last Post | |
Genetic Algorithm | UpperThrower4 | 3 | 3,154 |
Jul-16-2018, 09:32 AM Last Post: manishti2004 |
|
python genetic algorithme find max value | uther | 0 | 3,020 |
Apr-04-2018, 11:58 AM Last Post: uther |