mirror of
				https://github.com/ethereum/solidity
				synced 2023-10-03 13:03:40 +00:00 
			
		
		
		
	[yul-phaser] main: Add GenerationalElitistWithExclusivePools as an option and make it the default
This commit is contained in:
		
							parent
							
								
									0c61f6d18f
								
							
						
					
					
						commit
						a3e97108c5
					
				| @ -41,7 +41,8 @@ namespace po = boost::program_options; | |||||||
| 
 | 
 | ||||||
| enum class Algorithm | enum class Algorithm | ||||||
| { | { | ||||||
| 	Random | 	Random, | ||||||
|  | 	GEWEP | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| istream& operator>>(istream& inputStream, Algorithm& algorithm) | istream& operator>>(istream& inputStream, Algorithm& algorithm) | ||||||
| @ -51,6 +52,8 @@ istream& operator>>(istream& inputStream, Algorithm& algorithm) | |||||||
| 
 | 
 | ||||||
| 	if (value == "random") | 	if (value == "random") | ||||||
| 		algorithm = Algorithm::Random; | 		algorithm = Algorithm::Random; | ||||||
|  | 	else if (value == "GEWEP") | ||||||
|  | 		algorithm = Algorithm::GEWEP; | ||||||
| 	else | 	else | ||||||
| 		inputStream.setstate(ios_base::failbit); | 		inputStream.setstate(ios_base::failbit); | ||||||
| 
 | 
 | ||||||
| @ -61,6 +64,8 @@ ostream& operator<<(ostream& outputStream, Algorithm algorithm) | |||||||
| { | { | ||||||
| 	if (algorithm == Algorithm::Random) | 	if (algorithm == Algorithm::Random) | ||||||
| 		outputStream << "random"; | 		outputStream << "random"; | ||||||
|  | 	else if (algorithm == Algorithm::GEWEP) | ||||||
|  | 		outputStream << "GEWEP"; | ||||||
| 	else | 	else | ||||||
| 		outputStream.setstate(ios_base::failbit); | 		outputStream.setstate(ios_base::failbit); | ||||||
| 
 | 
 | ||||||
| @ -126,6 +131,23 @@ void runAlgorithm(string const& _sourcePath, Algorithm _algorithm) | |||||||
| 				} | 				} | ||||||
| 			).run(); | 			).run(); | ||||||
| 
 | 
 | ||||||
|  | 			break; | ||||||
|  | 		} | ||||||
|  | 		case Algorithm::GEWEP: | ||||||
|  | 		{ | ||||||
|  | 			GenerationalElitistWithExclusivePools( | ||||||
|  | 				population, | ||||||
|  | 				cout, | ||||||
|  | 				{ | ||||||
|  | 					/* mutationPoolSize = */ 0.25, | ||||||
|  | 					/* crossoverPoolSize = */ 0.25, | ||||||
|  | 					/* randomisationChance = */ 0.9, | ||||||
|  | 					/* deletionVsAdditionChance = */ 0.5, | ||||||
|  | 					/* percentGenesToRandomise = */ 0.1, | ||||||
|  | 					/* percentGenesToAddOrDelete = */ 0.1, | ||||||
|  | 				} | ||||||
|  | 			).run(); | ||||||
|  | 
 | ||||||
| 			break; | 			break; | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| @ -153,7 +175,7 @@ CommandLineParsingResult parseCommandLine(int argc, char** argv) | |||||||
| 		("seed", po::value<uint32_t>(), "Seed for the random number generator") | 		("seed", po::value<uint32_t>(), "Seed for the random number generator") | ||||||
| 		( | 		( | ||||||
| 			"algorithm", | 			"algorithm", | ||||||
| 			po::value<Algorithm>()->default_value(Algorithm::Random), | 			po::value<Algorithm>()->default_value(Algorithm::GEWEP), | ||||||
| 			"Algorithm" | 			"Algorithm" | ||||||
| 		) | 		) | ||||||
| 	; | 	; | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user