Skip to content

samuelebortolotti/google-hashcode-2022

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

Google Hashcode 2022

Repository concerning the test and the main problem of the Google Hashcode competition of 2022.

Members

Name Surname Github Username
Simone Alghisi Simone-Alghisi
Samuele Bortolotti samuelebortolotti
Francesco Bozzo FrancescoBozzo
Samuele Conti Samaretas

Contents

The repository is structured in the following way:

├── practice-problem
│   ├── Gemfile
│   ├── Gemfile.lock
│   ├── input
│   │   ├── a_an_example.in.txt
│   │   ├── b_basic.in.txt
│   │   ├── c_coarse.in.txt
│   │   ├── d_difficult.in.txt
│   │   └── e_elaborate.in.txt
│   ├── lib
│   │   └── main.rb
│   ├── output
│   ├── problem_statement.pdf
│   └── Rakefile
├── qualification-round
│   ├── Gemfile
│   ├── Gemfile.lock
│   ├── input
│   │   ├── a_an_example.in.txt
│   │   ├── b_better_start_small.in.txt
│   │   ├── c_collaboration.in.txt
│   │   ├── d_dense_schedule.in.txt
│   │   ├── e_exceptional_skills.in.txt
│   │   └── f_find_great_mentors.in.txt
│   ├── lib
│   │   └── main.rb
│   ├── output
│   ├── problem_statement.pdf
│   └── Rakefile
└── README.md

Inside of each folder there is everything you need to run the Ruby scripts.

Training problem

The training problem has been adressed by me employing with a very basic genetic algorithm.

Set up

To run the project code you can either run:

ruby lib/main.rb path_to_input_file n_generation n_population

Where:

  • path_to_input_file [String] is the path of the input file you want to run
  • n_generation [Integer] is the total number of generation you want to run
  • n_population [Integer] is the total number of dna you want in the population

Or employ one of the following Rake tasks:

rake code:run_file['file_path']

To run the file_path file with the default settings (specified in the Rakefile).

Or run:

rake code:zip

To run all the files in the 'input' directory with the default settings.

Zip the code

You can run:

rake code:run_all

To generate a folder named code.zip containing only the code of the repository.

For more information run rake -T

Qualification Round

The qualification problem has been adressed by the team employing a greedy strategy.

Note

The code present in the repository is not the one submitted during the competition, altough is quite similar in the behaviour.

The original solution has been proposed in Python, and since we were in a hurry, the code was quite difficult to understand; for this reason I have restructured the code and upgrade it by writing it in Ruby (since I am more familiar with it).

Set up

To run the project code you can either run:

ruby lib/main.rb path_to_input_file strategy

Where:

  • path_to_input_file [String] is the path of the input file you want to run
  • strategy [Integer] either 0 or 1, which is the strategy to employ during the run

Or employ one of the following Rake tasks:

rake "code:run_file['file_path', 0]"

Or equivalently with 1 instead of 0 for the other greedy approach.

To run the file_path file with the default settings (specified in the Rakefile).

Or run:

rake code:run_all[0]

To run all the files in the 'input' directory with the default settings.

Zip the code

You can run:

rake code:zip

To generate a folder named code.zip containing only the code of the repository.

For more information run rake -T

About

Repository containing the code I have written either alone or with my groupmates for the Google Hashcode competition

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages