Home | History | Annotate | Download | only in bestflags

Lines Matching refs:specs

45 def _GenerateRandomRasks(specs):
49 specs: A list of spec from which the flag set is created.
57 for spec in specs:
76 def _GenerateAllFlagsTasks(specs):
79 All the boolean flags in the specs will be enabled and all the numeric flag
83 specs: A list of spec from which the flag set is created.
91 for spec in specs:
107 def GenerateRandomGATasks(specs, num_tasks, num_trials):
111 specs: A list of spec from which the flag set is created.
124 new_flag = FlagSet([Flag(spec) for spec in specs if random.randint(0, 1)])
136 def _GenerateInitialFlags(specs, spec):
142 For example, if the specs are [-finline-limit=[1-1000], -fstrict-aliasing] and
148 specs: an array of specifications from which the result flag_set is created.
155 An array of flags, each of which contains one spec in specs. All the values
156 of the flags are the largest values in specs, expect the one that contains
161 for other_spec in specs:
163 # Found the spec in the array specs.
186 def _GenerateAllIterativeEliminationTasks(specs):
192 For example, if the specs are [-finline-limit=[1-1000], -fstrict-aliasing],
200 specs: an array of specifications from which the result flag_set is created.
211 for spec in specs:
226 for spec in specs:
227 results.add(Task(flags.FlagSet(_GenerateInitialFlags(specs, spec))))
232 def _ComputeCost(cost_func, specs, flag_set):
235 All the boolean flags in the specs will be enabled and all the numeric flag
241 specs: All the specs that are used in the algorithm. This is used to check
251 for spec in specs:
277 def _TestAlgorithm(cost_func, specs, generations, best_result):
285 specs: All the specs that are used in the algorithm. This is used to check
315 task_result = _ComputeCost(cost_func, specs, task.GetFlags())
357 # Generate the testing specs.
358 specs = self._GenerateFlagSpecifications()
362 generation_tasks = _GenerateAllFlagsTasks(specs)
363 generations = [HillClimbingBestBranch(generation_tasks, set([]), specs)]
368 _TestAlgorithm('sum(values[0:len(values)])', specs, generations, 0)
375 cost = _ComputeCost(cost_function, specs, all_flags)
379 generations = [HillClimbingBestBranch(generation_tasks, set([]), specs)]
384 _TestAlgorithm(cost_function, specs, generations, cost)
395 # Generate the testing specs.
396 specs = self._GenerateFlagSpecifications()
399 specs, MUTATION_RATE)
402 generation_tasks = GenerateRandomGATasks(specs, NUM_CHROMOSOMES, NUM_TRIALS)
406 _TestAlgorithm('sum(values[0:len(values)])', specs, generations, -1)
408 _TestAlgorithm(cost_func, specs, generations, -1)
419 # Generate the testing specs.
420 specs = self._GenerateFlagSpecifications()
425 generations = _GenerateAllIterativeEliminationTasks(specs)
430 _TestAlgorithm('sum(values[0:len(values)])', specs, generations, 0)
435 all_flags_tasks = _GenerateAllFlagsTasks(specs)
439 cost = _ComputeCost(cost_function, specs, all_flags)
446 _TestAlgorithm(cost_function, specs, generations, cost)