Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce ELO rating system #35

Merged
merged 3 commits into from
Mar 23, 2024
Merged

Introduce ELO rating system #35

merged 3 commits into from
Mar 23, 2024

Conversation

visitorckw
Copy link
Collaborator

@visitorckw visitorckw commented Mar 7, 2024

Implement the ELO rating system [1] to evaluate the relative strengths of various agents based on their performance. The ELO rating system, commonly utilized in assessing the skill levels of chess players, offers a reliable method to gauge the competitive abilities of agents in our context. This addition enhances our ability to make informed decisions and comparisons within our system.

Additionally, zobrist_destroy_table() function was added to free all allocated memory associated with the hash table to ensure the proper functioning of the ELO rating system.

Link: https://en.wikipedia.org/wiki/Elo_rating_system [1]

@visitorckw visitorckw requested a review from jserv March 7, 2024 15:25
@visitorckw visitorckw changed the title Introducing ELO rating system Introduce ELO rating system Mar 7, 2024
The zobrist_clear() function only released memory for all entries,
leaving the hash_table memory untouched. Add a new
zobrist_destroy_table() function to properly free all allocated memory
associated with the hash table.
@visitorckw visitorckw force-pushed the elo branch 2 times, most recently from 8a5f32c to 428277b Compare March 7, 2024 17:07
@ndsl7109256
Copy link
Contributor

  • When RL agent play a move, it would print the Q value for available moves. I thought these info can be removed when evaluating ELO.
  • Some guidance could be added to the README, and a build check could be included for GitHub Actions.

elo.c Outdated
printf("---------------------------------------------------------\n");

for (int i = 0; i < 3; ++i)
printf("%-10s | %-11.2f | %-10lld | %-10lld | %-10lld\n", agent_name[i],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo. %-11.2f should be %-10.2f

@visitorckw
Copy link
Collaborator Author

  • When RL agent play a move, it would print the Q value for available moves. I thought these info can be removed when evaluating ELO.

I'm thinking maybe we should default to turning off the related output messages unless the output option is enabled during compilation?

@ndsl7109256
Copy link
Contributor

I'm thinking maybe we should default to turning off the related output messages unless the output option is enabled during compilation?

It sounds good, these messages are intended for debug purposes and will not need to be displayed most of the time.

Makefile Outdated
@@ -8,6 +8,9 @@ MCTS = mcts
RL_CFLAGS := $(CFLAGS) -D USE_RL
MCTS_CFLAGS := $(CFLAGS) -D USE_MCTS
MCTS_LDFLAGS := $(LDFLAGS) -lm
ELO = elo
ELO_CFLAGS := $(CFLAGS) -lm
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drop -lm from CFLAGS.

elo.c Outdated

const char *agent_name[] = {"Negamax", "MCTS", "RL"};

long long int win[] = {0, 0, 0};
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you declare these variables as static?

Implement the ELO rating system [1] to evaluate the relative strengths
of various agents based on their performance. The ELO rating system,
commonly utilized in assessing the skill levels of chess players,
offers a reliable method to gauge the competitive abilities of agents
in our context. This addition enhances our ability to make informed
decisions and comparisons within our system.

Link: https://en.wikipedia.org/wiki/Elo_rating_system [1]
@visitorckw
Copy link
Collaborator Author

I'm thinking maybe we should default to turning off the related output messages unless the output option is enabled during compilation?

It sounds good, these messages are intended for debug purposes and will not need to be displayed most of the time.

Since the RL agent logging messages is not directly related to introducing the ELO system, I will file another PR to address this.

@jserv jserv merged commit 9cba66d into jserv:main Mar 23, 2024
2 checks passed
@jserv
Copy link
Owner

jserv commented Mar 23, 2024

Thank @visitorckw for contributing!

@visitorckw visitorckw deleted the elo branch March 23, 2024 03:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants