Example #1
0
    def get(self,client_id,num_programs):
        client_info = db.getClientInfo(client_id)

        problem_info = db.getProblem(client_info['problem_id'])

        if random() < problem_info['local_fetch_probability']/100.0:
            program_string = str(db.getProgramArray(db.getNeighborsForClient(client_id,num_programs)))
        else:
            strangers = db.getStrangersForClient(client_id,num_programs)
            programs = strangers + db.getNeighborsForClient(client_id,int(num_programs) - len(strangers))
            program_string = str(db.getProgramArray(programs))
        self.write(program_string)
        print "gave programs to client"
Example #2
0
 def post(self,problem_id):
     name = self.get_argument('name')
     comments = self.get_argument('comments')
     allowed_commands = self.get_argument('allowed_commands')
     start_population = self.get_argument('start_population')
     max_population = self.get_argument('max_population')
     tournament_size = self.get_argument('tournament_size')
     crossover_probability = self.get_argument('crossover_probability')
     mutation_probability = self.get_argument('mutation_probability')
     clone_probability = self.get_argument('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))
Example #3
0
 def get(self,problem_id):
     self.render("templates/admin/edit.html",problem=db.getProblem(problem_id))