How to pass variables to the fintness function in Genetic algorithm?
    4 visualizzazioni (ultimi 30 giorni)
  
       Mostra commenti meno recenti
    
    Mariem Harmassi
      
 il 8 Ott 2012
  
    
    
    
    
    Risposto: M Mirrashid
 il 5 Giu 2022
            hello I am testing a Genetic algorithm without using the global optimization toolbox, I have defined the fitness function in a separtae matlab file and it is called by the main program with ga function ,in my fitness function i need some parametrs from the main function .Can someone tell me hwo to do this ?? I thought about declaring the variables as global variables but it doesn t work ?
0 Commenti
Risposta accettata
Più risposte (3)
  Alan Weiss
    
      
 il 11 Ott 2012
        I'm sorry, I do not understand you. It is indeed possible to call the fitnes function with f = @(x)parameterfun(x,a,b,c). If you want more help, you will need to provide more information. Specifically:
1. Your function signature (function f = parameterfun(x,a,b))
2. Your calling syntax (x = ga(f,n,A,b))
3. All output MATLAB gives. I mean all, not an edited version.
Alan Weiss
MATLAB mathematical toolbox documentation
Vedere anche
Categorie
				Scopri di più su Genetic Algorithm in Help Center e File Exchange
			
	Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



