SELAB3 Python Code
Loading...
Searching...
No Matches
Functions
util.py File Reference

Some util functions that are used in the morphological evolution part and/or coevolution.py. More...

Functions

def morphevo.util.generate_arms (int amount)
 Generate a list of initial random arms with random genome. More...
 
def morphevo.util.alternate (list_to_alternate, times)
 Function to make an alternation of a list for x items. More...
 
def morphevo.util.alternate_infinite (list_to_alternate)
 Function to make an alternation of a list on which you can iterate till infinity. More...
 
def morphevo.util.normalize (list_to_normalize)
 Normalize a list. More...
 
def morphevo.util.write_morphevo_benchmarks (Arm arm)
 Output the benchmarks generated by morphevo code. More...
 
def morphevo.util.save_genome (Arm arm, str label)
 Save the urdf of an arm. More...
 

Detailed Description

Some util functions that are used in the morphological evolution part and/or coevolution.py.

Function Documentation

◆ alternate()

def morphevo.util.alternate (   list_to_alternate,
  times 
)

Function to make an alternation of a list for x items.

Example what = [1,2,3,4] times = 6 -> [1,2,3,4,1,2].

Parameters
list_to_alternateThe list that you want to alternate.
timesAmount of times you want to alternate your items.
Returns
Alternating list of size 'times'

◆ alternate_infinite()

def morphevo.util.alternate_infinite (   list_to_alternate)

Function to make an alternation of a list on which you can iterate till infinity.

Example list_to_alternate = [1,2,3,4] -> 1,2,3,4,1,2,3,4,1,2,3,4,...

Parameters
list_to_alternateThe list that you want to alternate.
Returns
Next iteration.

◆ generate_arms()

def morphevo.util.generate_arms ( int  amount)

Generate a list of initial random arms with random genome.

Parameters
amountAmount of arms needed.
Returns
List of arms.

◆ normalize()

def morphevo.util.normalize (   list_to_normalize)

Normalize a list.

Parameters
list_to_normalizeList to normalize.
Returns
List in which items are normalized.

◆ save_genome()

def morphevo.util.save_genome ( Arm  arm,
str  label 
)

Save the urdf of an arm.

Parameters
armArm to save genome for.
labelUnique label to add to the end of the name.

◆ write_morphevo_benchmarks()

def morphevo.util.write_morphevo_benchmarks ( Arm  arm)

Output the benchmarks generated by morphevo code.

Parameters
armArm to save benchmarks for.