Permalink
Browse files

add params to admin

  • Loading branch information...
Colin Roache
Colin Roache committed May 10, 2010
1 parent cf95424 commit 518d9a106999ebf0874cfb6217be4c22a6cee42e
Showing with 7 additions and 3 deletions.
  1. +2 −2 Server/db.py
  2. +3 −1 Server/dpgp.py
  3. +2 −0 Server/templates/admin/edit.html
View
@@ -64,10 +64,10 @@ def getClientInfo(client_id):
sql = "SELECT problem_id, island FROM clients WHERE id = '%s' LIMIT 1" % (client_id)
fetch = c.query(sql)[0]
return fetch
def updateProblem(problem_id,name,comments,allowed,start_population,max_population,tournament_size,crossover_probability,mutation_probability,clone_probability):
def updateProblem(problem_id,name,comments,allowed,start_population,max_population,tournament_size,crossover_probability,mutation_probability,clone_probability,stagnant_generations,num_programs_to_download):
c=getConnection()
return c.execute("UPDATE problems SET name = \"%s\", comments = \"%s\", allowed = \"%s\" start_population = \"%s\", max_population = \"%s\", tournament_size = \"%s\", crossover_probability = \"%s\", mutation_probability = \"%s\", clone_probability = \"%s\" WHERE id = %s LIMIT 1" % (name, comments, allowed, start_population,max_population,tournament_size,crossover_probability,mutation_probability, clone_probability, problem_id))
return c.execute("UPDATE problems SET name = \"%s\", comments = \"%s\", allowed = \"%s\" start_population = \"%s\", max_population = \"%s\", tournament_size = \"%s\", crossover_probability = \"%s\", mutation_probability = \"%s\", clone_probability = \"%s\", stagnant_generations = \"%s\", num_programs_to_download = \"%s\" WHERE id = %s LIMIT 1" % (name, comments, allowed, start_population,max_population,tournament_size,crossover_probability,mutation_probability, clone_probability, stagnant_generations, num_programs_to_download, problem_id))
def getNeighborsForClient(client_id,num_programs):
if num_programs == 0: return []
View
@@ -71,7 +71,9 @@ def post(self,problem_id):
crossover_probability = self.get_argument('crossover_probability')
mutation_probability = self.get_argument('mutation_probability')
clone_probability = self.get_argument('clone_probability')
db.updateProblem(problem_id,name,comments,allowed_commands,start_population,max_population,tournament_size,crossover_probability,mutation_probability,clone_probability)
num_programs_to_download = self.get_argument('num_programs_to_download')
stagnant_generations = self.get_argument('stagnant_generations')
db.updateProblem(problem_id,name,comments,allowed_commands,start_population,max_population,tournament_size,crossover_probability,mutation_probability,clone_probability,stagnant_generations,num_programs_to_download)
self.render("templates/admin/edit.html", problem=db.getProblem(problem_id))
@@ -23,6 +23,8 @@
<div>Crossover Probability: <input type="text" name="crossover_probability" value="{{ problem.crossover_probability }}" id="crossover_probability" /></div>
<div>Mutation Probability: <input type="text" name="mutation_probability" value="{{ problem.mutation_probability }}" id="mutation_probability" /></div>
<div>Clone Probability: <input type="text" name="clone_probability" value="{{ problem.clone_probability }}" id="clone_probability" /></div>
<div>Stagnant Generations:<input type="text" name="stagnant_generations" value="{{ gp_params.stagnant_generations }}" id="stagnant_generations" /></div>
<div>Number of Programs to Download:<input type="text" name="num_programs_to_download" value="{{ gp_params.num_programs_to_download }}" id="num_programs_to_download" /></div>
<div>Best fitness: {{ problem.bestFitness }}</div>
<div><a href="/worker{{ problem.id }}">Worker link</a></div>
<div><input type="submit" value="Edit"></div>

0 comments on commit 518d9a1

Please sign in to comment.