def get_optimal(opt_file, optimisation):
    """Returns the optimal value given the specified optimisation.

    Args:
      opt_file: The file with optimal results.
      optimisation: The optimisation value to return.

    Returns:
      Optimal value.
    """

    f = open(opt_file, "r")
    profile = ''
    for line in f:
        if optimisation == '-genmax' and 'optimal_generousmaxprofile' in line:
            spl = line.split()
            profile = ' '.join(spl[1:])
            return profile
        if optimisation == '-gremax' and 'optimal_greedymaxprofile' in line:
            spl = line.split()
            profile = ' '.join(spl[1:])
            return profile
        if optimisation == '-gre' and 'optimal_greedyprofile' in line:
            spl = line.split()
            profile = ' '.join(spl[1:])
            return profile