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

Fix the randomness while in benchmarking mode #294

Merged
merged 2 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions packages/packages.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
"contract/valory/staking_token/0.1.0": "bafybeig4fl35dn7d5gnprux2nwsqbirm7zkiujz3xvrwcjuktz6hkq4as4",
"contract/valory/relayer/0.1.0": "bafybeihzgjyvhtorugjw3yldznqsbwo3aqpxowm7k2nrvj6qtwpsc7jl7u",
"skill/valory/market_manager_abci/0.1.0": "bafybeigvo6hh2lz4h4om67qxugxdeq23inbezyo6u4bb3uth23tniuka6m",
"skill/valory/decision_maker_abci/0.1.0": "bafybeihiaqtntfiimcigik3flpzkukx75iy7swik362sl223xxhdmhzp6i",
"skill/valory/trader_abci/0.1.0": "bafybeihyx67x2yq2yjrnr7pdnsou2xkk6zdtq2deinm34ianzpj2cntzxu",
"skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeiai3nfeq2yza5h74cwjgxrqtpinr7zrzswsxccsfbpspjw4iv7zbe",
"skill/valory/decision_maker_abci/0.1.0": "bafybeifztxsujapt5f475f73zuok3pg4laj3slvf5ick6s3uxt7ds5qt3y",
"skill/valory/trader_abci/0.1.0": "bafybeiagrarjq27oiw5wdn3sxri7fre3yc5azn4jtektwf6cn2mxqzhlcq",
"skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeidr5qdyk7e4wkodpqrnf56t5xyqf4t7mwvtyqsziglb3uoadz5wwu",
"skill/valory/staking_abci/0.1.0": "bafybeidubhfvlf6x627t4wetc6ran5sb4pttjphyhv6vefp2a4kcuca2be",
"skill/valory/check_stop_trading_abci/0.1.0": "bafybeiboctfgetji6xlzw2buts5zsejnlrrhqkppme2p6fwzu26zznb324",
"agent/valory/trader/0.1.0": "bafybeialeu6vhsmgp7tinflxjnvj3maglufmxgg5qc6gyh4pydsznfnr4e",
"service/valory/trader/0.1.0": "bafybeidzoww6hshlry3unxud443v2oas7h7ybptzyxjd4g4qixkmt7bioe",
"service/valory/trader_pearl/0.1.0": "bafybeid5dskf55u6tlf5vguqe2zhfpykwwq5embgf4t7vgtjlxm2ibxsae"
"agent/valory/trader/0.1.0": "bafybeifna5cj46m3ytqixm3eqevnthzcxa7sq63eitybfmb23zelfrfb2u",
"service/valory/trader/0.1.0": "bafybeicdglua2ylh4fmqwi5o6rspv77gep5dtb247bn2xiwtwh5h4zcuza",
"service/valory/trader_pearl/0.1.0": "bafybeigpd2mqjnpkufadkgojgqb2qdtj4ygmjxgmllageykclpoyidb7le"
},
"third_party": {
"protocol/open_aea/signing/1.0.0": "bafybeihv62fim3wl2bayavfcg3u5e5cxu3b7brtu4cn5xoxd6lqwachasi",
Expand Down
6 changes: 3 additions & 3 deletions packages/valory/agents/trader/aea-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ skills:
- valory/reset_pause_abci:0.1.0:bafybeiameewywqigpupy3u2iwnkfczeiiucue74x2l5lbge74rmw6bgaie
- valory/termination_abci:0.1.0:bafybeif2zim2de356eo3sipkmoev5emwadpqqzk3huwqarywh4tmqt3vzq
- valory/transaction_settlement_abci:0.1.0:bafybeic3tccdjypuge2lewtlgprwkbb53lhgsgn7oiwzyrcrrptrbeyote
- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeiai3nfeq2yza5h74cwjgxrqtpinr7zrzswsxccsfbpspjw4iv7zbe
- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeidr5qdyk7e4wkodpqrnf56t5xyqf4t7mwvtyqsziglb3uoadz5wwu
- valory/market_manager_abci:0.1.0:bafybeigvo6hh2lz4h4om67qxugxdeq23inbezyo6u4bb3uth23tniuka6m
- valory/decision_maker_abci:0.1.0:bafybeihiaqtntfiimcigik3flpzkukx75iy7swik362sl223xxhdmhzp6i
- valory/trader_abci:0.1.0:bafybeihyx67x2yq2yjrnr7pdnsou2xkk6zdtq2deinm34ianzpj2cntzxu
- valory/decision_maker_abci:0.1.0:bafybeifztxsujapt5f475f73zuok3pg4laj3slvf5ick6s3uxt7ds5qt3y
- valory/trader_abci:0.1.0:bafybeiagrarjq27oiw5wdn3sxri7fre3yc5azn4jtektwf6cn2mxqzhlcq
- valory/staking_abci:0.1.0:bafybeidubhfvlf6x627t4wetc6ran5sb4pttjphyhv6vefp2a4kcuca2be
- valory/check_stop_trading_abci:0.1.0:bafybeiboctfgetji6xlzw2buts5zsejnlrrhqkppme2p6fwzu26zznb324
- valory/mech_interact_abci:0.1.0:bafybeih2cck5xu6yaibomwtm5zbcp6llghr3ighdnk56fzwu3ihu5xx35e
Expand Down
2 changes: 1 addition & 1 deletion packages/valory/services/trader/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ license: Apache-2.0
fingerprint:
README.md: bafybeigtuothskwyvrhfosps2bu6suauycolj67dpuxqvnicdrdu7yhtvq
fingerprint_ignore_patterns: []
agent: valory/trader:0.1.0:bafybeialeu6vhsmgp7tinflxjnvj3maglufmxgg5qc6gyh4pydsznfnr4e
agent: valory/trader:0.1.0:bafybeifna5cj46m3ytqixm3eqevnthzcxa7sq63eitybfmb23zelfrfb2u
number_of_agents: 4
deployment:
agent:
Expand Down
2 changes: 1 addition & 1 deletion packages/valory/services/trader_pearl/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ license: Apache-2.0
fingerprint:
README.md: bafybeibg7bdqpioh4lmvknw3ygnllfku32oca4eq5pqtvdrdsgw6buko7e
fingerprint_ignore_patterns: []
agent: valory/trader:0.1.0:bafybeialeu6vhsmgp7tinflxjnvj3maglufmxgg5qc6gyh4pydsznfnr4e
agent: valory/trader:0.1.0:bafybeifna5cj46m3ytqixm3eqevnthzcxa7sq63eitybfmb23zelfrfb2u
number_of_agents: 1
deployment:
agent:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def _select_tool(self) -> Generator[None, None, Optional[str]]:
return None

randomness = (
self.benchmarking_mode.randomness
(self.benchmarking_mode.randomness if self.is_first_period else None)
if self.benchmarking_mode.enabled
else self.synchronized_data.most_voted_randomness
)
Expand Down
6 changes: 4 additions & 2 deletions packages/valory/skills/decision_maker_abci/policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,14 @@ def update_weighted_accuracy(self) -> None:
for tool, acc_info in self.accuracy_store.items()
}

def select_tool(self, randomness: RandomnessType) -> Optional[str]:
def select_tool(self, randomness: RandomnessType = None) -> Optional[str]:
Copy link
Collaborator

Choose a reason for hiding this comment

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

you do not need to change the calls to this function so that only once the seed is past as a parameter?

"""Select a Mech tool and return its index."""
if self.n_tools == 0:
return None

random.seed(randomness)
if randomness is not None:
random.seed(randomness)

if not self.has_updated or random.random() < self.eps: # nosec
return self.random_tool

Expand Down
4 changes: 2 additions & 2 deletions packages/valory/skills/decision_maker_abci/skill.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ fingerprint:
behaviours/round_behaviour.py: bafybeibvhobpvzzd37ecleuyp2jrbed6nontcw7urtsilbbzvqsmmupx64
behaviours/sampling.py: bafybeibtkli72qsvotkrsepkgpiumtr5sershtkpb427oygnszs3dpgxry
behaviours/storage_manager.py: bafybeifelwjwstg5dwrnzeav5mumz47kqrlmv4crfn27a3vliomychd2x4
behaviours/tool_selection.py: bafybeifof3bsdwldpicpzicgra7wsn5sewpiy7swoxr3zaifwoax7t7nbq
behaviours/tool_selection.py: bafybeiat3mqtki55dnjmrrzpahjv3n26y5b45iehqx6tycqra76wtp7gxq
dialogues.py: bafybeigpwuzku3we7axmxeamg7vn656maww6emuztau5pg3ebsoquyfdqm
fsm_specification.yaml: bafybeicvrvzcjt4hg5jyr2eleoajpbb7q2fbq2bopmbnwy33fsjdblzygu
handlers.py: bafybeigod6gbjrxy4mbmulbzsbokeaoycoqys64vqtxnumishfukzf73za
io_/__init__.py: bafybeifxgmmwjqzezzn3e6keh2bfo4cyo7y5dq2ept3stfmgglbrzfl5rq
io_/loader.py: bafybeih3sdsx5dhe4kzhtoafexjgkutsujwqy3zcdrlrkhtdks45bc7exa
models.py: bafybeihsvfsa5dbx54p3twnln5wbln2annmnszfrrzdguweugffdlsuigu
payloads.py: bafybeia32ds4ks5g3rhd43w6siy74vi5inaheuxhswiy5ndykxtgncoeu4
policy.py: bafybeibplob3nb5yu24kdiiucaaupmd4t3pf7gi6kueov76nhimcysyczi
policy.py: bafybeihp4lzv4ejyu6k5reukbpa6kamglicpymxfx6obm5pgugik4vc63y
redeem_info.py: bafybeifiiix4gihfo4avraxt34sfw35v6dqq45do2drrssei2shbps63mm
rounds.py: bafybeieffmnu3sivnagmhrhcufnh5zun6pxligc6wp26me43u6cjy2y3xi
states/__init__.py: bafybeid23llnyp6j257dluxmrnztugo5llsrog7kua53hllyktz4dqhqoy
Expand Down
4 changes: 2 additions & 2 deletions packages/valory/skills/trader_abci/skill.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ skills:
- valory/transaction_settlement_abci:0.1.0:bafybeic3tccdjypuge2lewtlgprwkbb53lhgsgn7oiwzyrcrrptrbeyote
- valory/termination_abci:0.1.0:bafybeif2zim2de356eo3sipkmoev5emwadpqqzk3huwqarywh4tmqt3vzq
- valory/market_manager_abci:0.1.0:bafybeigvo6hh2lz4h4om67qxugxdeq23inbezyo6u4bb3uth23tniuka6m
- valory/decision_maker_abci:0.1.0:bafybeihiaqtntfiimcigik3flpzkukx75iy7swik362sl223xxhdmhzp6i
- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeiai3nfeq2yza5h74cwjgxrqtpinr7zrzswsxccsfbpspjw4iv7zbe
- valory/decision_maker_abci:0.1.0:bafybeifztxsujapt5f475f73zuok3pg4laj3slvf5ick6s3uxt7ds5qt3y
- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeidr5qdyk7e4wkodpqrnf56t5xyqf4t7mwvtyqsziglb3uoadz5wwu
- valory/staking_abci:0.1.0:bafybeidubhfvlf6x627t4wetc6ran5sb4pttjphyhv6vefp2a4kcuca2be
- valory/check_stop_trading_abci:0.1.0:bafybeiboctfgetji6xlzw2buts5zsejnlrrhqkppme2p6fwzu26zznb324
- valory/mech_interact_abci:0.1.0:bafybeih2cck5xu6yaibomwtm5zbcp6llghr3ighdnk56fzwu3ihu5xx35e
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ protocols:
- valory/ledger_api:1.0.0:bafybeihdk6psr4guxmbcrc26jr2cbgzpd5aljkqvpwo64bvaz7tdti2oni
skills:
- valory/abstract_round_abci:0.1.0:bafybeiar2yhzxacfe3qqamqhaihtlcimquwedffctw55sowx6rac3cm3ui
- valory/decision_maker_abci:0.1.0:bafybeihiaqtntfiimcigik3flpzkukx75iy7swik362sl223xxhdmhzp6i
- valory/decision_maker_abci:0.1.0:bafybeifztxsujapt5f475f73zuok3pg4laj3slvf5ick6s3uxt7ds5qt3y
- valory/staking_abci:0.1.0:bafybeidubhfvlf6x627t4wetc6ran5sb4pttjphyhv6vefp2a4kcuca2be
- valory/mech_interact_abci:0.1.0:bafybeih2cck5xu6yaibomwtm5zbcp6llghr3ighdnk56fzwu3ihu5xx35e
behaviours:
Expand Down
Loading