6.3 Running The Default Optimisation

  1. Once you have completed the installation steps you can run either of the containers depending on your approach and needs.
./robocup-nvidia-slow 

  1. Inside the terminal window that would have popped up after the previous step, navigate to the kick directory assuming you are already in the base folder of the codeBase or in other words repository root.
cd optimization/kick

My base code is in a folder called RoboCup that is why you can see that in the image below

If you use ls in terminal you should see the following:

  1. Once there you can execute ./run.sh (Don’t run the run_optimisation.py file directly), and you should get output similar to, be patient it may take a few moments :
One run took 146.37s
Step 1 / 3. Current score = 2.82. Overall best = -1
One run took 146.32s
        Writing best results (with score 3.079 now) to results/sa/mode_kick_ik/type_0/2021-10-24_13-12-55-norm_True_kick_ik/best_params.txt and results/recent/my_first_run.txt
Step 2 / 3. Current score = 3.08. Overall best = 3.079
One run took 146.33s
Step 3 / 3. Current score = 3.08. Overall best = 3.079
One run took 146.3s
After 3 operations, we got a final score of             3.079 and a best score of             3.079.             The best score was saved to results/sa/mode_kick_ik/type_0/2021-10-24_13-12-55-norm_True_kick_ik

What you have done is basically run an optimisation procedure which which uses the default optimisation algorithm on the default optimisation task

  1. To go further, have a look at the run_optimisation.py file, specifically around here:
optim_algo_to_use = SimulatedAnnealingExample(start_indiv, labels, unique_identifier='my_first_run', verbose=True)

and

num_steps = 4

Fundamentally, you could try and change the num steps, or experiment with the already existing optimisation methods provided, but also feel free to create your own. If you do so, we suggest copying the implementation from examples/RandomSearch.py and going from there. Your task is to implement the run function, and the building blocks at your disposal are:

Mutation of a current individual

new_indiv = current_indiv.mutate_and_copy(0.05)

Scoring / Evaluating an individual

new_score = self.get_fitness(new_indiv)

Using the above you can do whatever you like, but please keep these last few lines like they are, to continuously save the results, and at the end return the final individuals

            # Save every now and then
            if i % 100 == 0:
                self.save_indiv(current_indiv, current_score)

        return current_indiv, current_score