def generate_experiment_info(config):
    """
    Generate experiment info, to be displayed by GPS Trainig GUI.
    Assumes config is the config created in hyperparams.py
    """
    common = config['common']
    algorithm = config['algorithm']

    if type(algorithm['cost']) == list:
        algorithm_cost_type = algorithm['cost'][0]['type'].__name__
        if (algorithm_cost_type) == 'CostSum':
            algorithm_cost_type += '(%s)' % ', '.join(
                    map(lambda cost: cost['type'].__name__,
                        algorithm['cost'][0]['costs']))
    else:
        algorithm_cost_type = algorithm['cost']['type'].__name__
        if (algorithm_cost_type) == 'CostSum':
            algorithm_cost_type += '(%s)' % ', '.join(
                    map(lambda cost: cost['type'].__name__,
                        algorithm['cost']['costs']))

    if 'dynamics' in algorithm:        
        alg_dyn = str(algorithm['dynamics']['type'].__name__)
    else:
        alg_dyn = 'None'       

    return (
        'exp_name:   ' + str(common['experiment_name'])              + '\n' +
        'alg_type:   ' + str(algorithm['type'].__name__)             + '\n' +
        'alg_dyn:    ' + alg_dyn + '\n' +
        'alg_cost:   ' + str(algorithm_cost_type)                    + '\n' +
        'iterations: ' + str(config['iterations'])                   + '\n' +
        'conditions: ' + str(algorithm['conditions'])                + '\n' +
        'samples:    ' + str(config['num_samples'])                  + '\n'
    )