Changeset 1129 for framspy/evolalg


Ignore:
Timestamp:
04/11/21 03:27:06 (4 years ago)
Author:
Maciej Komosinski
Message:

Introduced tournament size as a command-line parameter

Location:
framspy/evolalg/examples
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • framspy/evolalg/examples/niching_novelty.py

    r1128 r1129  
    6565    parser.add_argument('-fit', required=False, default=Fitness.raw, type=Fitness,
    6666                        help=' Fitness criteria DEFAULT = raw', choices=list(Fitness))
    67     parser.add_argument('-popsize', type=int, default=50, help="Size of population, default 50.")
     67    parser.add_argument('-popsize', type=int, default=50, help="Population size, default 50.")
    6868    parser.add_argument('-generations', type=int, default=5, help="Number of generations, default 5.")
    69     parser.add_argument('-num_parts', type=int, default=None, help="Maximum number of parts. Default None")
     69    parser.add_argument('-tournament', type=int, default=5, help="Tournament size, default 5.")
     70    parser.add_argument('-num_parts', type=int, default=None, help="Maximum number of Parts. Default: no limit")
    7071    parser.add_argument('-checkpoint_path', required=False, default=None, help="Path to the checkpoint file")
    7172    parser.add_argument('-checkpoint_interval', required=False, type=int, default=100, help="Checkpoint interval")
     
    117118
    118119    # Selection procedure
    119     selection = TournamentSelection(5,
     120    selection = TournamentSelection(parsed_args.tournament,
    120121                                    copy=True)  # 'fitness' by default, the targeted attribute can be changed, e.g. fit_attr="fitness_raw"
    121122
  • framspy/evolalg/examples/standard.py

    r1128 r1129  
    4141                        help='Genetic format for the demo run, for example 4, 9, or B. If not given, f1 is assumed.')
    4242
    43     parser.add_argument("-popsize", type=int, default=50, help="Size of population, default 50.")
     43    parser.add_argument("-popsize", type=int, default=50, help="Population size, default 50.")
    4444    parser.add_argument('-generations', type=int, default=5, help="Number of generations, default 5.")
     45    parser.add_argument('-tournament', type=int, default=5, help="Tournament size, default 5.")
    4546    return parser.parse_args()
    4647
     
    7879                   statistics_union]
    7980
    80     selection = TournamentSelection(5, copy=True, fit_attr="fitness")
     81    selection = TournamentSelection(parsed_args.tournament, copy=True, fit_attr="fitness")
    8182
    8283    new_generation_steps = [
Note: See TracChangeset for help on using the changeset viewer.