-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid calculating non-sensical runtime profiles
When calculating runtime profiles, make sure we don't aggregate over multiple problem sizes (both objective and variables). Instead, raises an exception. Partial fix for #4.
- Loading branch information
1 parent
aa08b6f
commit 0c4b1fe
Showing
4 changed files
with
57 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import pytest | ||
|
||
from cocoviz.exceptions import BadResultSetException | ||
from cocoviz import runtime_profiles, Result, ResultSet, ProblemDescription | ||
|
||
|
||
HV_a1 = { | ||
"fevals": [ 1, 2, 3, 10, 20, 50, 100], | ||
"hypervolume": [ 10, 20, 30, 40, 50, 60, 70], | ||
"r2": [ 20, 40, 60, 80, 100, 120, 140] | ||
} | ||
|
||
HV_a2 = { | ||
"fevals": [ 1, 2, 3, 10, 20, 50, 100], | ||
"hypervolume": [ 12, 22, 32, 42, 52, 62, 72], | ||
"r2": [ 22, 42, 62, 82, 102, 122, 142] | ||
} | ||
|
||
def test_aggregate_over_objectives(): | ||
pd_f1_d2 = ProblemDescription("f1", "i1", 10, 2) | ||
pd_f1_d3 = ProblemDescription("f1", "i1", 10, 3) | ||
rs = ResultSet([ | ||
Result("a1", pd_f1_d2, HV_a1), | ||
Result("a1", pd_f1_d3, HV_a1) | ||
]) | ||
|
||
with pytest.raises(BadResultSetException): | ||
runtime_profiles(rs, indicator="hypervolume") | ||
|
||
def test_aggregate_over_variables(): | ||
pd_f1_d2 = ProblemDescription("f1", "i1", 10, 2) | ||
pd_f1_d3 = ProblemDescription("f1", "i1", 20, 2) | ||
rs = ResultSet([ | ||
Result("a1", pd_f1_d2, HV_a1), | ||
Result("a1", pd_f1_d3, HV_a1) | ||
]) | ||
|
||
with pytest.raises(BadResultSetException): | ||
runtime_profiles(rs, indicator="hypervolume") |