def validator(self,NEAT_file):
        """ Validate a single run. 

        Args:
            NEAT_File: file for the NEAT genome
        """
        global man, quadruped

        # Initialize the manager to be unique to the process.
        man = ODEManager(near_callback, stepsize=self.dt/self.n, log_data=self.log_frames, run_num=self.run_num)

        # Initialize the quadruped
        quadruped = Quadruped(man=man)

        # If logging the output, tell manager to write the body type, dimensions, and position to the logging file.
        if self.log_frames:
            man.log_world_setup(self.eval_time,ind_num=self.run_num)

        # Load in the best performing NEAT genome
        genome = NEAT.Genome(NEAT_file)
        self.current_network = NEAT.NeuralNetwork()
        if not self.hyperNEAT:
            genome.BuildPhenotype(self.current_network)
        else:
            genome.BuildHyperNEATPhenotype(self.current_network,self.substrate)

        fit = self.physics_only_simulation_validator()

        print(fit)
Пример #2
0
    def validator(self, NEAT_file):
        """ Validate a single run. 

        Args:
            NEAT_File: file for the NEAT genome
        """
        global man, quadruped

        # Initialize the manager to be unique to the process.
        man = ODEManager(near_callback,
                         stepsize=self.dt / self.n,
                         log_data=self.log_frames,
                         run_num=self.run_num)

        # Initialize the quadruped
        quadruped = Quadruped(man=man)

        # If logging the output, tell manager to write the body type, dimensions, and position to the logging file.
        if self.log_frames:
            man.log_world_setup(self.eval_time, ind_num=self.run_num)

        # Load in the best performing NEAT genome
        genome = NEAT.Genome(NEAT_file)
        self.current_network = NEAT.NeuralNetwork()
        if not self.hyperNEAT:
            genome.BuildPhenotype(self.current_network)
        else:
            genome.BuildHyperNEATPhenotype(self.current_network,
                                           self.substrate)

        fit = self.physics_only_simulation_validator()

        print(fit)
Пример #3
0
    def debug_validator(self):
        """ Validate a single run. """
        global man, worm

        if self.aquatic:
            grav = 0
            fluid_dyn = 1
        else:
            grav = -9.81
            fluid_dyn = 0

        # Initialize the manager to be unique to the process.
        man = ODEManager(near_callback,
                         stepsize=self.dt / self.n,
                         log_data=self.log_frames,
                         run_num=self.run_num,
                         gravity=grav,
                         fluid_dynamics=fluid_dyn)

        # Initialize the worm
        worm = Worm(man=man, num_joints=self._num_joints)

        # If logging the output, tell manager to write the body type, dimensions, and position to the logging file.
        if self.log_frames:
            man.log_world_setup(self.eval_time, ind_num=self.run_num)

        fit = self.physics_only_simulation_validator()

        print(fit)
    def validator(self):
        """ Validate a single run. 

        Args:
            NEAT_File: file for the NEAT genome
        """
        global man, test_setup

        # Initialize the manager to be unique to the process.
        man = ODEManager(near_callback,
                         gravity=0,
                         stepsize=self.dt / self.n,
                         log_data=self.log_frames,
                         run_num=self.run_num)

        # Initialize the quadruped
        test_setup = Test_Setup(man=man)

        # If logging the output, tell manager to write the body type, dimensions, and position to the logging file.
        if self.log_frames:
            man.log_world_setup(self.eval_time, ind_num=self.run_num)

        fit = self.physics_only_simulation_validator()

        print(fit)
    def debug_validator(self):
        """ Validate a single run. """
        global man, quadruped

        # Initialize the manager to be unique to the process.
        man = ODEManager(near_callback, stepsize=self.dt/self.n, log_data=self.log_frames, run_num=self.run_num)

        # Initialize the quadruped
        quadruped = Quadruped(man=man)

        # If logging the output, tell manager to write the body type, dimensions, and position to the logging file.
        if self.log_frames:
            man.log_world_setup(self.eval_time,ind_num=self.run_num)

        fit = self.physics_only_simulation_validator()

        print(fit)
    def debug_validator(self):
        """ Validate a single run. """
        global man, quadruped

        # Initialize the manager to be unique to the process.
        man = ODEManager(near_callback, stepsize=self.dt/self.n, log_data=self.log_frames, run_num=self.run_num)

        # Initialize the quadruped
        quadruped = Quadruped(man=man)

        # If logging the output, tell manager to write the body type, dimensions, and position to the logging file.
        if self.log_frames:
            man.log_world_setup(self.eval_time,ind_num=self.run_num)

        fit = self.physics_only_simulation_validator()

        print(fit)
    def validator(self,NEAT_file,Morph_file):
        """ Validate a single run. 

        Args:
            NEAT_File: file for the NEAT genome
            Morph_file: file for the morphology components
        """
        global man, quadruped

        self.validating = True

        # Initialize the manager to be unique to the process.
        man = ODEManager(near_callback, stepsize=self.dt/self.n, log_data=self.log_frames, run_num=self.run_num,erp=0.5,cfm=1E-2)

        genome = [0,{}]
        if NEAT_file:
            # Load in the best performing NEAT genome
            genome[0] = NEAT.Genome(NEAT_file)
            self.current_network = NEAT.NeuralNetwork()
            if not self.hyperNEAT:
                genome[0].BuildPhenotype(self.current_network)
            else:
                genome[0].BuildHyperNEATPhenotype(self.current_network,self.substrate)

        if Morph_file:
            with open(Morph_file,"r") as f:
                line = f.readline()
                line = line.strip().split(',')
                genome[1]['erp'] = float(line[0])
                genome[1]['cfm'] = float(line[1])

        # Initialize the quadruped
        quadruped = Quadruped(man=man,morphology_genome={'erp':genome[1]['erp'],'cfm':genome[1]['cfm']})

        # If logging the output, tell manager to write the body type, dimensions, and position to the logging file.
        # Must be placed after creating the quadruped.
        if self.log_frames:
            man.log_world_setup(self.eval_time,ind_num=self.run_num)

        fit = self.physics_only_simulation_validator()

        return self.ann_activations,self.joint_feedback