finish multi-app examples

This commit is contained in:
rhythmcao
2024-02-01 00:53:31 +08:00
parent c7fb35de50
commit fc15a33b70
13 changed files with 844 additions and 23 deletions

View File

@@ -294,6 +294,7 @@ class DesktopEnv(gym.Env):
self.setup_controller.setup(self.evaluator.get("postconfig", []))
if type(self.metric) == list:
results = []
for idx, metric in enumerate(self.metric):
try:
config = self.evaluator["result"][idx]
@@ -310,11 +311,12 @@ class DesktopEnv(gym.Env):
**self.metric_options[idx]) if expected_state is not None \
else metric(result_state, **self.metric_options[idx])
if self.metric_conj == 'and' and not bool(metric):
if self.metric_conj == 'and' and float(metric) == 0.0:
return 0
elif self.metric_conj == 'or' and bool(metric):
elif self.metric_conj == 'or' and float(metric) == 1.0:
return 1
return 1 if self.metric_conj == 'and' else 0
else: results.append(metric)
return sum(results) / len(results) if self.metric_conj == 'and' else max(results)
else:
try:
result_state = self.result_getter(self, self.evaluator["result"])