diff --git a/scripts/test_algorithm b/scripts/test_algorithm index f4170779..a81af646 100644 --- a/scripts/test_algorithm +++ b/scripts/test_algorithm @@ -52,7 +52,7 @@ if __name__ == "__main__": tig_verifier_path = shutil.which("tig-verifier") parser = argparse.ArgumentParser(description="TIG Algorithm Tester") parser.add_argument("algorithm", type=str, help="Algorithm name") - parser.add_argument("size", type=int, help="Size of the problem instance") + parser.add_argument("race_id", type=str, help="Race Id of the problem instance, comma separated key-values (e.g. a=1,b=2)") parser.add_argument("hyperparameters", type=str, help="JSON string of hyperparameters for the algorithm (can set to null)") parser.add_argument("--tig-runtime-path", type=str, default=tig_runtime_path, help=f"Path to tig-runtime executable (default: {tig_runtime_path})") parser.add_argument("--tig-verifier-path", type=str, default=tig_verifier_path, help=f"Path to tig-verifier executable (default: {tig_verifier_path})") @@ -103,7 +103,7 @@ f"""Library not found at {so_path}: } challenge_id = challenge_ids[CHALLENGE] - settings = {"algorithm_id": "", "challenge_id": challenge_id, "size": args.size, "block_id": "", "player_id": ""} + settings = {"algorithm_id": "", "challenge_id": challenge_id, "race_id": args.race_id, "block_id": "", "player_id": ""} pool = ThreadPoolExecutor(max_workers=args.workers + 1) results = {} diff --git a/tig-benchmarker/common/structs.py b/tig-benchmarker/common/structs.py index 025001c0..77670343 100644 --- a/tig-benchmarker/common/structs.py +++ b/tig-benchmarker/common/structs.py @@ -186,7 +186,7 @@ class ChallengeState(FromDict): @dataclass class ChallengeBlockData(FromDict): num_qualifiers: int - qualifier_difficulties: Set[Point] + qualifier_qualities: Dict[str, List[int]] @dataclass class Challenge(FromDict): diff --git a/tig-benchmarker/ui/src/app/pages/home/home.component.html b/tig-benchmarker/ui/src/app/pages/home/home.component.html index 97b43a5e..8b73ca1c 100644 --- a/tig-benchmarker/ui/src/app/pages/home/home.component.html +++ b/tig-benchmarker/ui/src/app/pages/home/home.component.html @@ -141,8 +141,8 @@ -
- [innerHTML]="formatRaceId(benchmark.race_id)"> +
+ {{ benchmark.race_id_display }}
diff --git a/tig-benchmarker/ui/src/app/pages/home/home.component.scss b/tig-benchmarker/ui/src/app/pages/home/home.component.scss index 16f5b566..e79c3dbf 100644 --- a/tig-benchmarker/ui/src/app/pages/home/home.component.scss +++ b/tig-benchmarker/ui/src/app/pages/home/home.component.scss @@ -78,3 +78,7 @@ .tig-header { text-transform: uppercase; } + +.multiline { + white-space: pre-line; +} \ No newline at end of file diff --git a/tig-benchmarker/ui/src/app/pages/home/home.component.ts b/tig-benchmarker/ui/src/app/pages/home/home.component.ts index 35e2ad20..dd5bb01c 100644 --- a/tig-benchmarker/ui/src/app/pages/home/home.component.ts +++ b/tig-benchmarker/ui/src/app/pages/home/home.component.ts @@ -123,11 +123,4 @@ export class HomeComponent { clearInterval(this.interval); } } - - formatRaceId(value: string): string { - if (!value) return ''; - return value - .replace(/=/g, ': ') - .replace(/,/g, '
'); - } } diff --git a/tig-benchmarker/ui/src/app/services/tig-apis.service.ts b/tig-benchmarker/ui/src/app/services/tig-apis.service.ts index 18fdf1fe..d0e9d74b 100644 --- a/tig-benchmarker/ui/src/app/services/tig-apis.service.ts +++ b/tig-benchmarker/ui/src/app/services/tig-apis.service.ts @@ -100,8 +100,13 @@ export class TigApisService { }; }); + const race_id_display = b.race_id + .replace(/=/g, ': ') + .replace(/,/g, '\n'); + return { ...b, + race_id_display, time_elapsed, benchmark_id_display, batches, diff --git a/tig-runtime/src/main.rs b/tig-runtime/src/main.rs index 1939d2cc..bcd802ee 100644 --- a/tig-runtime/src/main.rs +++ b/tig-runtime/src/main.rs @@ -116,7 +116,12 @@ pub fn compute_solution( ) -> Result<()>>(b"entry_point")? }; - let race = dejsonify(&settings.race_id).map_err(|_| { + let race_id = if settings.race_id.starts_with('"') && settings.race_id.ends_with('"') { + settings.race_id.clone() + } else { + format!(r#""{}""#, settings.race_id) + }; + let race = serde_json::from_str(&race_id).map_err(|_| { anyhow::anyhow!( "Failed to parse race_id '{}' as {}::Race", settings.race_id, diff --git a/tig-verifier/src/main.rs b/tig-verifier/src/main.rs index 0fdf13c9..5145284b 100644 --- a/tig-verifier/src/main.rs +++ b/tig-verifier/src/main.rs @@ -64,7 +64,12 @@ pub fn verify_solution( macro_rules! dispatch_challenge { ($c:ident, cpu) => {{ - let race = dejsonify(&settings.race_id).map_err(|_| { + let race_id = if settings.race_id.starts_with('"') && settings.race_id.ends_with('"') { + settings.race_id.clone() + } else { + format!(r#""{}""#, settings.race_id) + }; + let race = serde_json::from_str(&race_id).map_err(|_| { anyhow::anyhow!( "Failed to parse race_id '{}' as {}::Race", settings.race_id,