-
Notifications
You must be signed in to change notification settings - Fork 211
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adjust the probabilities based on empirical data to achieve less unev…
…en coverage of the action space during simulation (#6562) Signed-off-by: Markus Alexander Kuppe <[email protected]> Co-authored-by: Amaury Chamayou <[email protected]>
- Loading branch information
Showing
5 changed files
with
69 additions
and
131 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,65 +1,40 @@ | ||
---------- MODULE SIMCoverageccfraft ---------- | ||
EXTENDS ccfraft, TLC, Integers, CSV, TLCExt | ||
|
||
CONSTANTS | ||
NodeOne, NodeTwo, NodeThree, NodeFour, NodeFive | ||
$ wget https://nightly.tlapl.us/dist/tla2tools.jar | ||
$ wget https://github.com/tlaplus/CommunityModules/releases/latest/download/CommunityModules-deps.jar | ||
## Run with as many workers as you like to parallelize the nested simulation runs (auto uses all your cores). | ||
$ java -jar tla2tools.jar -config SIMCoverageccfraft.tla SIMCoverageccfraft.tla -workers auto | ||
|
||
Servers_mc == {NodeOne, NodeTwo, NodeThree, NodeFour, NodeFive} | ||
----------------------------- MODULE SIMCoverageccfraft ----------------------------- | ||
EXTENDS TLC, Naturals, Sequences, IOUtils | ||
|
||
Baseline == | ||
{<<"Next", 0..0, 0..0, 0..0>>} | ||
CmdLine == | ||
<<"sh", "-c", | ||
"java " \o | ||
"-XX:+UseParallelGC " \o | ||
"-Dtlc2.tool.impl.Tool.cdot=true " \o | ||
"-Dtlc2.tool.Simulator.extendedStatistics=true " \o | ||
"-jar tla2tools.jar " \o | ||
"-depth 1000 " \o | ||
"-simulate SIMccfraft.tla >> SIMCoverageccfraft.txt 2>&1">> | ||
|
||
Confs == | ||
Baseline \cup | ||
({"SIMNext"} \X {1..1, 1..10, 1..100} \X {201..201, 201..210, 201..300} \X {401..401, 401..410, 401..500}) | ||
----------------------------------------------------------------------------- | ||
|
||
VARIABLE conf | ||
VARIABLE c, d | ||
|
||
CCF == INSTANCE ccfraft | ||
Init == | ||
/\ c \in [ R: {10, 1000}, C: {10, 1000}, Q: {10, 1000}, T: {10, 1000} ] | ||
/\ d = FALSE | ||
|
||
SIMInitReconfigurationVars == | ||
\/ CCF!InitLogConfigServerVars(Servers, JoinedLog) | ||
\/ CCF!InitReconfigurationVars | ||
Next == | ||
/\ ~d | ||
/\ d' = TRUE | ||
/\ PrintT(<<"conf", c>>) | ||
/\ IOEnvExec(c, CmdLine).exitValue = 0 | ||
/\ UNCHANGED c | ||
|
||
SIMCheckQuorum(i) == | ||
/\ conf[1] # "Next" => RandomElement(1..1000) \in conf[3] | ||
/\ CCF!CheckQuorum(i) | ||
|
||
SIMChangeConfigurationInt(i, newConfiguration) == | ||
/\ conf[1] # "Next" => RandomElement(1..1000) \in conf[4] | ||
/\ CCF!ChangeConfigurationInt(i, newConfiguration) | ||
|
||
SIMTimeout(i) == | ||
/\ \/ RandomElement(1..1000) \in conf[2] | ||
\/ conf[1] # "Next" | ||
\* Always allow Timeout if no messages are in the network | ||
\* and no node is a candidate or leader. Otherwise, the system | ||
\* will deadlock if 1 # RandomElement(...). | ||
\/ /\ \A s \in Servers: leadershipState[s] \notin {Leader, Candidate} | ||
/\ Network!Messages = {} | ||
/\ CCF!Timeout(i) | ||
|
||
SIMCoverageSpec == | ||
/\ Init | ||
/\ conf \in Confs | ||
/\ [][UNCHANGED conf /\ Next]_<<vars, conf>> | ||
|
||
------------------------------------------------------------------------------ | ||
|
||
CSVFile == "SIMCoverageccfraft_S" \o ToString(Cardinality(Servers)) \o ".csv" | ||
|
||
CSVColumnHeaders == | ||
"Spec#P#Q#R#currentTerm#state#commitIndex#log#node" | ||
|
||
ASSUME | ||
CSVRecords(CSVFile) = 0 => | ||
CSVWrite(CSVColumnHeaders, <<>>, CSVFile) | ||
|
||
StatisticsStateConstraint == | ||
(TLCGet("level") > TLCGet("config").depth) => | ||
TLCDefer(\A s \in Servers : CSVWrite("%1$s#%2$s#%3$s#%4$s#%5$s#%6$s#%7$s#%8$s#%9$s", | ||
<< conf[1], Cardinality(conf[2]), Cardinality(conf[3]), Cardinality(conf[4]), | ||
currentTerm[s], leadershipState[s], commitIndex[s], Len(log[s]), s | ||
>>, | ||
CSVFile)) | ||
============================================================================= | ||
---- CONFIG SIMCoverageccfraft ---- | ||
INIT Init | ||
NEXT Next | ||
CHECK_DEADLOCK FALSE | ||
==== |
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