-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: continue the warmup when one configuration fails
- Loading branch information
Showing
12 changed files
with
203 additions
and
46 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
48 changes: 48 additions & 0 deletions
48
...in/java/ai/timefold/solver/quarkus/benchmark/it/domain/TestdataListValueShadowEntity.java
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,48 @@ | ||
package ai.timefold.solver.quarkus.benchmark.it.domain; | ||
|
||
import ai.timefold.solver.core.api.domain.entity.PlanningEntity; | ||
import ai.timefold.solver.core.api.domain.variable.InverseRelationShadowVariable; | ||
import ai.timefold.solver.core.api.domain.variable.ShadowVariable; | ||
|
||
@PlanningEntity | ||
public class TestdataListValueShadowEntity { | ||
|
||
private String value; | ||
|
||
@InverseRelationShadowVariable(sourceVariableName = "values") | ||
private TestdataStringLengthShadowEntity entity; | ||
|
||
@ShadowVariable(variableListenerClass = StringLengthVariableListener.class, sourceVariableName = "entity") | ||
private Integer length; | ||
|
||
public TestdataListValueShadowEntity() { | ||
} | ||
|
||
public TestdataListValueShadowEntity(String value) { | ||
this.value = value; | ||
} | ||
|
||
public String getValue() { | ||
return value; | ||
} | ||
|
||
public void setValue(String value) { | ||
this.value = value; | ||
} | ||
|
||
public TestdataStringLengthShadowEntity getEntity() { | ||
return entity; | ||
} | ||
|
||
public void setEntity(TestdataStringLengthShadowEntity entity) { | ||
this.entity = entity; | ||
} | ||
|
||
public Integer getLength() { | ||
return length; | ||
} | ||
|
||
public void setLength(Integer length) { | ||
this.length = length; | ||
} | ||
} |
40 changes: 23 additions & 17 deletions
40
...java/ai/timefold/solver/quarkus/benchmark/it/domain/TestdataStringLengthShadowEntity.java
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 |
---|---|---|
@@ -1,37 +1,43 @@ | ||
package ai.timefold.solver.quarkus.benchmark.it.domain; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import ai.timefold.solver.core.api.domain.entity.PlanningEntity; | ||
import ai.timefold.solver.core.api.domain.variable.PlanningVariable; | ||
import ai.timefold.solver.core.api.domain.variable.ShadowVariable; | ||
import ai.timefold.solver.core.api.domain.lookup.PlanningId; | ||
import ai.timefold.solver.core.api.domain.variable.PlanningListVariable; | ||
|
||
@PlanningEntity | ||
public class TestdataStringLengthShadowEntity { | ||
|
||
@PlanningVariable(valueRangeProviderRefs = "valueRange") | ||
private String value; | ||
@PlanningId | ||
private Long id; | ||
|
||
@PlanningListVariable | ||
private List<TestdataListValueShadowEntity> values; | ||
|
||
@ShadowVariable(variableListenerClass = StringLengthVariableListener.class, | ||
sourceEntityClass = TestdataStringLengthShadowEntity.class, sourceVariableName = "value") | ||
private Integer length; | ||
public TestdataStringLengthShadowEntity() { | ||
} | ||
|
||
public TestdataStringLengthShadowEntity(Long id) { | ||
this.id = id; | ||
this.values = new ArrayList<>(); | ||
} | ||
|
||
// ************************************************************************ | ||
// Getters/setters | ||
// ************************************************************************ | ||
|
||
public String getValue() { | ||
return value; | ||
} | ||
|
||
public void setValue(String value) { | ||
this.value = value; | ||
public Long getId() { | ||
return id; | ||
} | ||
|
||
public Integer getLength() { | ||
return length; | ||
public List<TestdataListValueShadowEntity> getValues() { | ||
return values; | ||
} | ||
|
||
public void setLength(Integer length) { | ||
this.length = length; | ||
public void setValues(List<TestdataListValueShadowEntity> values) { | ||
this.values = values; | ||
} | ||
|
||
} |
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
2 changes: 1 addition & 1 deletion
2
...-integration/quarkus-benchmark/integration-test/src/main/resources/application.properties
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
# The solver runs to a known best score to avoid a HTTP timeout in this simple implementation. | ||
quarkus.timefold.benchmark.solver.termination.best-score-limit=0hard/5soft | ||
quarkus.timefold.benchmark.solver.termination.best-score-limit=0hard/10soft |
63 changes: 63 additions & 0 deletions
63
...src/test/java/ai/timefold/solver/quarkus/benchmark/it/TimefoldBenchmarkBlueprintTest.java
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,63 @@ | ||
package ai.timefold.solver.quarkus.benchmark.it; | ||
|
||
import static org.apache.http.params.CoreConnectionPNames.SO_TIMEOUT; | ||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import java.nio.file.Files; | ||
import java.nio.file.Path; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import io.quarkus.test.junit.QuarkusTest; | ||
import io.quarkus.test.junit.QuarkusTestProfile; | ||
import io.quarkus.test.junit.TestProfile; | ||
import io.restassured.RestAssured; | ||
import io.restassured.config.HttpClientConfig; | ||
import io.restassured.config.RestAssuredConfig; | ||
import io.restassured.path.xml.XmlPath; | ||
|
||
/** | ||
* Test the benchmark for typical solver configs (blueprint). | ||
*/ | ||
@QuarkusTest | ||
@TestProfile(TimefoldBenchmarkBlueprintTest.BlueprintTestProfile.class) | ||
class TimefoldBenchmarkBlueprintTest { | ||
|
||
@Test | ||
void benchmark() throws Exception { | ||
RestAssuredConfig timeoutConfig = RestAssured.config() | ||
.httpClient(HttpClientConfig.httpClientConfig() | ||
.setParam(SO_TIMEOUT, 10000)); | ||
String benchmarkResultDirectory = RestAssured | ||
.given() | ||
.config(timeoutConfig) | ||
.header("Content-Type", "text/plain;charset=UTF-8") | ||
.when() | ||
.post("/timefold/test/benchmark") | ||
.body().asString(); | ||
assertThat(benchmarkResultDirectory).isNotNull(); | ||
Path benchmarkResultDirectoryPath = Path.of(benchmarkResultDirectory); | ||
assertThat(Files.isDirectory(benchmarkResultDirectoryPath)).isTrue(); | ||
Path benchmarkResultPath = Files.walk(benchmarkResultDirectoryPath, 2) | ||
.filter(path -> path.endsWith("plannerBenchmarkResult.xml")).findFirst().orElseThrow(); | ||
assertThat(Files.isRegularFile(benchmarkResultPath)).isTrue(); | ||
XmlPath xmlPath = XmlPath.from(benchmarkResultPath.toFile()); | ||
assertThat(xmlPath | ||
.getList( | ||
"plannerBenchmarkResult.solverBenchmarkResult.singleBenchmarkResult.subSingleBenchmarkResult.succeeded") | ||
.stream().anyMatch(node -> node.equals("true"))) | ||
.isTrue(); | ||
} | ||
|
||
public static class BlueprintTestProfile implements QuarkusTestProfile { | ||
|
||
@Override | ||
public Map<String, String> getConfigOverrides() { | ||
Map<String, String> overrides = new HashMap<>(QuarkusTestProfile.super.getConfigOverrides()); | ||
overrides.put("quarkus.timefold.benchmark.solver-benchmark-config-xml", "blueprintSolverBenchmarkConfig.xml"); | ||
return overrides; | ||
} | ||
} | ||
} |
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
24 changes: 24 additions & 0 deletions
24
.../quarkus-benchmark/integration-test/src/test/resources/blueprintSolverBenchmarkConfig.xml
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,24 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<plannerBenchmark xmlns="https://timefold.ai/xsd/benchmark" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="https://timefold.ai/xsd/benchmark https://timefold.ai/xsd/benchmark/benchmark.xsd"> | ||
<parallelBenchmarkCount>AUTO</parallelBenchmarkCount> | ||
|
||
<inheritedSolverBenchmark> | ||
<solver> | ||
<solutionClass>ai.timefold.solver.quarkus.benchmark.it.domain.TestdataStringLengthShadowSolution</solutionClass> | ||
<entityClass>ai.timefold.solver.quarkus.benchmark.it.domain.TestdataStringLengthShadowEntity</entityClass> | ||
<entityClass>ai.timefold.solver.quarkus.benchmark.it.domain.TestdataListValueShadowEntity</entityClass> | ||
<scoreDirectorFactory> | ||
<constraintProviderClass>ai.timefold.solver.quarkus.benchmark.it.solver.TestdataStringLengthConstraintProvider</constraintProviderClass> | ||
</scoreDirectorFactory> | ||
<termination> | ||
<secondsSpentLimit>5</secondsSpentLimit> | ||
</termination> | ||
</solver> | ||
</inheritedSolverBenchmark> | ||
|
||
<solverBenchmarkBluePrint> | ||
<solverBenchmarkBluePrintType>EVERY_CONSTRUCTION_HEURISTIC_TYPE_WITH_EVERY_LOCAL_SEARCH_TYPE</solverBenchmarkBluePrintType> | ||
</solverBenchmarkBluePrint> | ||
</plannerBenchmark> |