Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/parameter value distribution #1253

Draft
wants to merge 198 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
198 commits
Select commit Hold shift + click to select a range
4d7296b
Replace msg names to new ones
HansRobo Oct 20, 2022
bcce201
Merge branch 'feature/empty/parameter_value_distribution' into featur…
HansRobo Nov 8, 2022
51064fa
Revert "Delete distribution evaluation implementation"
HansRobo Nov 8, 2022
2c83256
Revert "Delete distribution evaluation implementation"
HansRobo Nov 8, 2022
fde2aa3
doc(interpreter): update comments for stochastic distributions
HansRobo Nov 8, 2022
ff0bbfb
chore(compile error): fix compile error
HansRobo Nov 8, 2022
d4f4a02
feat(interpreter): implement DistributionSet::evaluate
HansRobo Nov 10, 2022
0f88fc2
fix(interpreter): add missing attribute in DistributionRange
HansRobo Nov 10, 2022
70ac4dc
feat(interpreter): implement DistributionRange::evaluate
HansRobo Nov 10, 2022
408e1ef
Merge branch 'feature/empty/parameter_value_distribution-fixed' into …
HansRobo Dec 5, 2022
4cacaa4
chore(interpreter): fix include guard
HansRobo Dec 7, 2022
edfebf7
chore(interpreter): fix include path
HansRobo Dec 7, 2022
1f69890
feat(interpreter): add SingleParameterList struct
HansRobo Dec 7, 2022
17aec1e
Merge remote-tracking branch 'origin/master' into feature/parameter_v…
HansRobo Dec 19, 2022
3900b81
refactor(interpreter): update interface
HansRobo Dec 23, 2022
a37bd58
refactor(interpreter): update interface
HansRobo Dec 23, 2022
fd23c5c
feat(interpreter): add base classes for parameter distributions
HansRobo Jan 6, 2023
05afff8
chore(interpreter): delete support for UserDefinedDistribution
HansRobo Jan 6, 2023
e52220c
feat(interpreter): use single parameter distribution interface in sto…
HansRobo Jan 6, 2023
e06dd23
feat(interpreter): implement Stochatic::derive()
HansRobo Jan 6, 2023
a38941a
feat(interpreter): implement DeterministicSingleParameterDistribution…
HansRobo Jan 6, 2023
1e8308a
feat(interpreter): implement DeterministicMultiParameterDistribution:…
HansRobo Jan 6, 2023
2d696d3
feat(interpreter/ParameterValueDistribution): implement distribution …
HansRobo Feb 9, 2023
7fedfce
feat(interpreter/ParameterValueDistribution): use new struct for dist…
HansRobo Feb 9, 2023
a016211
Merge remote-tracking branch 'origin/master' into feature/parameter_v…
HansRobo Feb 9, 2023
9632f25
chore: apply linter
HansRobo Feb 9, 2023
a98e3d4
chore: apply linter
HansRobo Feb 9, 2023
c808580
chore: apply linter
HansRobo Feb 10, 2023
9d4fe5b
feat(interpreter/ParameterValueDistribution): categorize various clas…
HansRobo Feb 10, 2023
a85608a
fix(CMake): add missing cpp file to target
HansRobo Feb 10, 2023
bc9a76f
refactor(interpreter/ParameterValueDistribution): merge ParameterDist…
HansRobo Feb 10, 2023
75db7e8
refactor(interpreter/ParameterValueDistribution): add process for emp…
HansRobo Feb 10, 2023
d9b2494
feat(interpreter/ParameterValueDistribution): implement derive functi…
HansRobo Feb 10, 2023
4206d8a
feat(interpreter/ParameterValueDistribution): implement derive functi…
HansRobo Feb 10, 2023
ac5ab69
Merge remote-tracking branch 'origin/master' into feature/parameter_v…
HansRobo Feb 16, 2023
2541a25
fix(interpreter/ParameterValueDistribution): fix element name
HansRobo Feb 20, 2023
1fc9dcb
fix(interpreter/ParameterValueDistribution): support list of Determin…
HansRobo Feb 20, 2023
a801e7c
fix(interpreter/ParameterValueDistribution): fix implementation of me…
HansRobo Feb 21, 2023
b548822
fix(interpreter/ParameterValueDistribution): fix choice argument
HansRobo Feb 21, 2023
01860c6
refactor(interpreter/ParameterValueDistribution): DeterministicSingle…
HansRobo Feb 21, 2023
d240e51
fix(interpreter/ParameterValueDistribution): DeterministicSingleParam…
HansRobo Feb 21, 2023
9711cae
fix(interpreter/ParameterValueDistribution): replace choice with read…
HansRobo Feb 21, 2023
a7d1227
fix(interpreter): fix element name
HansRobo Feb 21, 2023
b03a255
fix(preprocessor): fix output derived scenario
HansRobo Feb 21, 2023
5e6f1f7
Merge remote-tracking branch 'origin/master' into feature/parameter_v…
HansRobo Feb 21, 2023
f6426c9
refactor(interpreter/ParameterValueDistribution)
HansRobo Feb 21, 2023
0035cc5
doc: update ReleaseNotes
HansRobo Feb 21, 2023
a9d6248
Merge remote-tracking branch 'origin/master' into feature/parameter_v…
HansRobo Mar 3, 2023
34b0fbb
feat(openscenario_utility): add xml_validator.hpp
HansRobo Apr 7, 2023
1ef240f
Merge remote-tracking branch 'origin/master' into feature/parameter_v…
HansRobo Apr 7, 2023
1106834
Merge remote-tracking branch 'origin/rewrite/xml_validation' into fea…
HansRobo Apr 7, 2023
b7e8108
refactor(openscenario_preprocessor)
HansRobo Apr 7, 2023
17e12e0
chore(cspell): add "xerces" to dictionary
HansRobo Apr 7, 2023
3f149d7
chore(cspell): fix typo
HansRobo Apr 7, 2023
80505e4
doc(scenario_test_runner): add sample scenarios
HansRobo Apr 7, 2023
4e11164
chore(scenario_test_runner): update sample scenarios
HansRobo Apr 7, 2023
d0f7acf
chore(openscenario_preprocessor): fix xsd_path option
HansRobo Apr 10, 2023
a208135
feat(openscenario_preprocessor): add output_directory option
HansRobo Apr 10, 2023
789c345
fix(openscenario_interpreter): fix ParameterValueSet::evaluate()
HansRobo Apr 10, 2023
998560c
update scenarios
HansRobo Apr 10, 2023
c80a6b8
update scenarios
HansRobo Apr 10, 2023
59c9868
fix(openscenario_preprocessor): share random_engine
HansRobo Apr 10, 2023
43f0d11
fix(openscenario_preprocessor): convert parameters into std::string
HansRobo Apr 10, 2023
ad9975f
chore: apply linter
HansRobo Apr 10, 2023
0787ef3
refactor(openscenario_preprocessor): fix inheritance access keywords
HansRobo Apr 11, 2023
e01a528
fix(openscenario_preprocessor): fix probability_distribution_set.cpp
HansRobo Apr 11, 2023
e6092b5
feat(openscenario_interpreter): add getNumberOfDeriveScenarios() to d…
HansRobo Apr 11, 2023
c104f06
feat(openscenario_interpreter): add derive() for single derivation of…
HansRobo Apr 12, 2023
491304e
chore: apply linter
HansRobo Apr 12, 2023
808748d
chore(openscenario_preprocessor): fix build error
HansRobo Apr 12, 2023
31e2199
feat(openscenario_interpreter): implement derive() for parallel deriv…
HansRobo Apr 14, 2023
c2fa772
chore(openscenario_interpreter): fix unnecessary inherit access
HansRobo Apr 14, 2023
9e77931
chore(openscenario_preprocessor): fix indent of package.xml
HansRobo Apr 14, 2023
688e180
chore(openscenario_preprocessor): delete unused code
HansRobo Apr 14, 2023
8b35b94
refactor(openscenario_interpreter)
HansRobo Apr 14, 2023
a8fbb6f
Merge remote-tracking branch 'origin/fix/cspell_errors' into feature/…
HansRobo Apr 14, 2023
b5c29bf
apply linter
HansRobo Apr 17, 2023
4656c01
Merge remote-tracking branch 'origin/master' into feature/parameter_v…
HansRobo Apr 17, 2023
261cf77
chore(openscenario_preprocessor): delete debug lines
HansRobo Apr 17, 2023
8ba9d36
refactor(openscenario_interpreter): refactor base class
HansRobo Apr 17, 2023
2f9c1ff
feat(openscenario_preprocessor): change derived scenario extension
HansRobo Apr 17, 2023
b7e4b96
refactor
HansRobo Apr 17, 2023
7e990e0
chore: fix indent of xml and xosc files
HansRobo Apr 17, 2023
3bda669
chore: delete confusing comments
HansRobo Apr 17, 2023
a5ba436
refactor(openscenario_interpreter): use std::size_t instead of size_t
HansRobo Apr 17, 2023
7da09eb
refactor(xml_validator): use modern C++
HansRobo Apr 17, 2023
8d61899
chore: apply linter
HansRobo Apr 17, 2023
0dc850c
chore: apply linter
HansRobo Apr 17, 2023
67bfc28
apply yamasaki-san's patch
HansRobo Apr 20, 2023
ba236d0
apply yamasaki-san's second patch
HansRobo Apr 26, 2023
4cf5657
chore: fix cspell error
HansRobo Apr 26, 2023
e0741ed
apply linter
HansRobo Apr 26, 2023
51d09ae
refactor(openscenario_interpreter): delete unused functions
HansRobo May 2, 2023
ee4bd72
Merge branch 'master' into feature/parameter_value_distribution
HansRobo May 12, 2023
8020f1d
chore: apply linter
HansRobo May 12, 2023
b56eae1
Merge remote-tracking branch 'origin/master' into feature/parameter_v…
HansRobo May 16, 2023
640dd00
Merge remote-tracking branch 'origin/master' into feature/parameter_v…
HansRobo May 22, 2023
26a35bc
Merge remote-tracking branch 'origin/master' into feature/parameter_v…
HansRobo May 22, 2023
6da7ace
Merge remote-tracking branch 'origin/master' into feature/parameter_v…
HansRobo May 25, 2023
23149b5
Merge remote-tracking branch 'origin/master' into feature/parameter_v…
HansRobo Jun 28, 2023
c78ec15
Merge remote-tracking branch 'origin/master' into feature/parameter_v…
HansRobo Aug 4, 2023
c203628
fix(openscenario_preprocessor): fix errors due to incomplete followin…
HansRobo Aug 7, 2023
fc29eb8
Merge remote-tracking branch 'origin/master' into feature/parameter_v…
HansRobo Aug 10, 2023
578207a
Merge remote-tracking branch 'origin/master' into feature/parameter_v…
HansRobo Aug 23, 2023
6017796
Merge remote-tracking branch 'origin/master' into feature/parameter_v…
HansRobo Sep 22, 2023
43a21db
Merge remote-tracking branch 'origin/master' into feature/parameter_v…
HansRobo Oct 10, 2023
84281bc
Merge remote-tracking branch 'origin/master' into feature/parameter_v…
HansRobo Oct 11, 2023
f5f7792
Merge remote-tracking branch 'origin/master' into feature/parameter_v…
HansRobo Oct 16, 2023
4951338
Merge remote-tracking branch 'origin/master' into feature/parameter_v…
HansRobo Nov 14, 2023
8e86b3a
Merge remote-tracking branch 'origin/master' into feature/parameter_v…
HansRobo Nov 21, 2023
ac4e2e7
chore(cspell): update ignorePaths in custom_spell.json
HansRobo Nov 21, 2023
57cb9fd
Merge branch 'master' into feature/parameter_value_distribution
HansRobo Dec 8, 2023
d55b06c
Merge remote-tracking branch 'origin/master' into feature/parameter_v…
HansRobo Feb 15, 2024
b967c69
Merge remote-tracking branch 'origin/master' into feature/parameter_v…
HansRobo Feb 15, 2024
621b3f1
Merge remote-tracking branch 'origin/master' into feature/parameter_v…
HansRobo Mar 12, 2024
9e2ac27
Merge branch 'master' into feature/parameter_value_distribution
HansRobo Apr 1, 2024
f6fc2db
doc: update OpenSCENARIO definition annotation to OpenSCENARIO XML 1.3
HansRobo Apr 1, 2024
0dfb734
feat(openscenario_interpreter): add LogNormalDistribution
HansRobo Apr 3, 2024
35833b7
fix(openscenario_interpreter): fix wrong initialization for NormalDis…
HansRobo Apr 3, 2024
02a0954
fix: compile error on LogNormalDistribution
HansRobo Apr 5, 2024
3370b64
Merge remote-tracking branch 'origin/master' into feature/parameter_v…
HansRobo Apr 9, 2024
89313d5
fix: preprocessor node name
HansRobo Apr 10, 2024
696457e
Merge branch 'master' into feature/parameter_value_distribution
HansRobo Apr 10, 2024
53294c9
chore: ignore lognormal on cspell
HansRobo Apr 10, 2024
7aaed65
Merge remote-tracking branch 'origin/feature/parameter_value_distribu…
HansRobo Apr 10, 2024
02a2a5a
chore: update openscenario_validator version
HansRobo Apr 10, 2024
fe527be
feat: update OpenSCENARIO version for openscenario_validator
HansRobo Apr 10, 2024
5d63584
Merge remote-tracking branch 'origin/master' into feature/parameter_v…
HansRobo Apr 11, 2024
0ba011b
Merge branch 'master' into feature/parameter_value_distribution
HansRobo Apr 17, 2024
ce5089b
Merge remote-tracking branch 'origin/feature/openscenario_validator' …
HansRobo Apr 17, 2024
99b1b31
doc: add sample scenario for LogNormalDistribution
HansRobo Apr 17, 2024
9823292
refactor: move parameter value distribution files
HansRobo Apr 18, 2024
9ead47c
feat: add test for DistributionRange
HansRobo Apr 18, 2024
948765e
feat: add test for deterministic distributions
HansRobo Apr 19, 2024
5424768
Merge remote-tracking branch 'origin/master' into feature/parameter_v…
HansRobo Apr 19, 2024
87e92cf
feat: add tests for stochastic distributions
HansRobo Apr 19, 2024
b800686
chore: apply linter
HansRobo Apr 19, 2024
bec6514
fix: retry derivation if it over the range instead of using std::clamp
HansRobo Apr 22, 2024
da24b36
refactor: use std::default_random_engine for parameter value distribu…
HansRobo Apr 22, 2024
44a470d
refactor: update test parameters
HansRobo Apr 22, 2024
b4b89c4
Merge remote-tracking branch 'origin/feature/openscenario_validator' …
HansRobo Apr 23, 2024
d28bc1d
refactor: rename ParameterList into ParameterSet
HansRobo Apr 23, 2024
872212f
fix: cmake configuration for openscenario_validator
HansRobo Apr 24, 2024
9882926
refactor: stop using nifty counter in OpenSCENARIOValidator
HansRobo Apr 24, 2024
f8df589
chore: update test for ProbabilityDistributionSet
HansRobo Apr 24, 2024
48db217
Merge remote-tracking branch 'origin/master' into feature/parameter_v…
HansRobo Apr 24, 2024
a2882b6
fix: adjust export settings of openscenario_validator
HansRobo Apr 25, 2024
7e1bff9
refactor: use const reference in ranged for loop
HansRobo Apr 25, 2024
d15d16b
refactor: use const reference
HansRobo Apr 25, 2024
1f51e47
refactor: mergeParameterDistribution
HansRobo Apr 25, 2024
c12fbf3
refactor: Improved accuracy of results in DistributionRange
HansRobo Apr 25, 2024
7b1b3a4
feat: add test for merging deterministic distributions
HansRobo Apr 25, 2024
161cfac
refactor: use EXPECT_DOUBLE_EQ for testing double variables
HansRobo Apr 25, 2024
6e9885b
fix: fix modify test value due to random engine update
HansRobo Apr 25, 2024
6aeb6a3
chore: improve test for ProbabilityDistributionSet
HansRobo Apr 25, 2024
6b0d1a1
refactor: refactor tests
HansRobo Apr 25, 2024
2d6dead
fix: fix wrong number of derivations in DistributionRange
HansRobo Apr 25, 2024
65f3ab8
Merge branch 'master' into feature/parameter_value_distribution
HansRobo Apr 25, 2024
05a2558
Merge remote-tracking branch 'origin/feature/openscenario_validator' …
HansRobo Apr 30, 2024
fa57d73
Merge remote-tracking branch 'origin/feature/openscenario_validator' …
HansRobo May 7, 2024
b93356b
Merge remote-tracking branch 'origin/feature/openscenario_validator' …
HansRobo May 7, 2024
58e89db
Merge branch 'refs/heads/feature/openscenario_validator' into feature…
HansRobo May 8, 2024
5826ed7
Merge remote-tracking branch 'origin/feature/openscenario_validator' …
HansRobo May 8, 2024
4b53db9
Merge remote-tracking branch 'origin/feature/openscenario_validator' …
HansRobo May 16, 2024
828bc27
fix: fix bug in Histogram::BinAdaptor
HansRobo May 17, 2024
9279d4b
refactor: delete Histogram::BinAdaptor
HansRobo May 17, 2024
c9fdc8c
Merge remote-tracking branch 'origin/master' into feature/parameter_v…
HansRobo May 17, 2024
b77e3ae
chore: update test for Histogram
HansRobo May 17, 2024
e38d6e7
Merge remote-tracking branch 'origin/refactor/openscenario_validator'…
HansRobo May 20, 2024
49ecced
refactor: delete unnecessary diff
HansRobo May 20, 2024
5196779
chore: add TIER IV extension `conditionEdge="sticky"`
HansRobo May 20, 2024
a3e17a2
refactor:
HansRobo May 20, 2024
9e791d0
chore: port ControllerAction.AssignControllerAction.yaml to OpenSCENA…
HansRobo May 20, 2024
f98d768
Merge remote-tracking branch 'origin/master' into feature/parameter_v…
HansRobo May 21, 2024
9b494ac
refactor: clean up CMakeLists.txt in openscenario_preprocessor
HansRobo May 21, 2024
60f271f
Merge remote-tracking branch 'origin/master' into feature/parameter_v…
HansRobo May 22, 2024
5c83558
Merge remote-tracking branch 'origin/refactor/openscenario_validator'…
HansRobo May 22, 2024
40832ef
refactor: simplify ProbabilityDistributionSet
HansRobo May 24, 2024
11c3eba
Merge branch 'master' into feature/parameter_value_distribution
HansRobo May 28, 2024
307eeb7
Merge branch 'master' into feature/parameter_value_distribution
HansRobo May 30, 2024
49548cd
Merge branch 'master' into feature/parameter_value_distribution
HansRobo Jun 4, 2024
fae9295
Merge branch 'master' into feature/parameter_value_distribution
HansRobo Jun 10, 2024
d376533
Merge branch 'master' into feature/parameter_value_distribution
HansRobo Jun 11, 2024
cd58ac1
fix: fix initialization of ProbabilityDistributionSet
HansRobo Jun 12, 2024
02a829b
fix: fix compile errors
HansRobo Jun 12, 2024
9bbc372
Merge branch 'master' into feature/parameter_value_distribution
HansRobo Jun 12, 2024
722a919
Merge branch 'master' into feature/parameter_value_distribution
HansRobo Jun 19, 2024
3cadfe3
Merge branch 'master' into feature/parameter_value_distribution
HansRobo Jun 27, 2024
2482478
Merge branch 'master' into feature/parameter_value_distribution
HansRobo Jul 4, 2024
3952eb2
Merge branch 'master' into feature/parameter_value_distribution
HansRobo Jul 31, 2024
d343bf5
Merge branch 'master' into feature/parameter_value_distribution
HansRobo Aug 19, 2024
d036323
Merge branch 'master' into feature/parameter_value_distribution
HansRobo Sep 18, 2024
7d49af0
Merge branch 'master' into feature/parameter_value_distribution
HansRobo Sep 30, 2024
4863e20
Merge branch 'master' into feature/parameter_value_distribution
HansRobo Nov 12, 2024
d580a25
Merge branch 'master' into feature/parameter_value_distribution
HansRobo Nov 18, 2024
e4acb4d
Merge branch 'master' into feature/parameter_value_distribution
HansRobo Nov 27, 2024
546562e
Merge branch 'master' into feature/parameter_value_distribution
HansRobo Dec 2, 2024
2352faa
Merge branch 'master' into feature/parameter_value_distribution
HansRobo Dec 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ inline auto concatenate = [](auto &&... xs) {
} // namespace scenario_simulator_exception
} // namespace common

#endif // OPENSCENARIO_INTERPRETER__CONCATENATE_HPP_
#endif // SCENARIO_SIMULATOR_EXCEPTION__CONCATENATE_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ constexpr decltype(auto) fold_right(F && f, T && x, Ts &&... xs)
} // namespace scenario_simulator_exception
} // namespace common

#endif // OPENSCENARIO_INTERPRETER__FOLD_HPP_
#endif // SCENARIO_SIMULATOR_EXCEPTION__FOLD_HPP_
7 changes: 7 additions & 0 deletions openscenario/openscenario_interpreter/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ ament_auto_add_library(${PROJECT_NAME} SHARED
src/object.cpp
src/evaluate.cpp
src/openscenario_interpreter.cpp
src/parameter_distribution.cpp
src/record.cpp
src/scope.cpp)

Expand Down Expand Up @@ -92,6 +93,10 @@ install(
FILES ${CMAKE_CURRENT_SOURCE_DIR}/features
DESTINATION lib/${PROJECT_NAME})

install(
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/test
DESTINATION share/${PROJECT_NAME})

# ------------------------------------------------------------------------------
# test
# ------------------------------------------------------------------------------
Expand All @@ -100,7 +105,9 @@ if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
ament_lint_auto_find_test_dependencies()
ament_add_gtest(test_syntax test/test_syntax.cpp)
ament_add_gtest(test_parameter_value_distribution test/test_parameter_value_distribution.cpp)
target_link_libraries(test_syntax ${PROJECT_NAME})
target_link_libraries(test_parameter_value_distribution ${PROJECT_NAME})
endif()

ament_auto_package()
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
// Copyright 2015 TIER IV, Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef OPENSCENARIO_INTERPRETER__PARAMETER_DISTRIBUTION_HPP_
#define OPENSCENARIO_INTERPRETER__PARAMETER_DISTRIBUTION_HPP_

#include <memory>
#include <openscenario_interpreter/object.hpp>
#include <scenario_simulator_exception/exception.hpp>
#include <string>
#include <unordered_map>
#include <vector>

namespace openscenario_interpreter
{
// parameter set like {a: 1.0, b: 2.0,...}
using ParameterSet = std::unordered_map<std::string, Object>;
using ParameterSetSharedPtr = std::shared_ptr<ParameterSet>;
// list of ParameterList
using ParameterDistribution = std::vector<ParameterSetSharedPtr>;
using SingleUnnamedParameterDistribution = std::vector<Object>;

// TODO(HansRobo): implement parallel derivable parameter distribution with this base struct
struct ParallelDerivableParameterValueDistributionBase
{
virtual auto derive(
std::size_t local_index, std::size_t local_size, std::size_t global_index,
std::size_t global_size) -> ParameterSet = 0;

virtual auto getNumberOfDeriveScenarios() const -> std::size_t
{
throw Error("getNumberOfDeriveScenarios() is not implemented");
}
};

// generator types distribution
struct SingleParameterDistributionBase
{
virtual auto derive() -> SingleUnnamedParameterDistribution = 0;
};

struct MultiParameterDistributionBase
{
virtual auto derive() -> ParameterDistribution = 0;
};

struct StochasticParameterDistributionBase
{
virtual auto derive() -> Object = 0;
};

// container types of distribution data generator
struct ParameterDistributionContainer
{
virtual auto derive() -> ParameterDistribution = 0;
};

auto mergeParameterDistribution(
const ParameterDistribution & distribution, const ParameterDistribution & additional_distribution)
-> ParameterDistribution;

template <typename DistributionT>
ParameterDistribution mergeParameterDistributionList(
const ParameterDistribution & base_distribution,
const std::list<DistributionT> & distribution_list)
{
ParameterDistribution merged_distribution{base_distribution};
for (const auto & additional_distribution : distribution_list) {
merged_distribution = mergeParameterDistribution(
merged_distribution,
apply(
[](const auto & distribution) { return distribution.derive(); }, additional_distribution));
}
return merged_distribution;
}
} // namespace openscenario_interpreter
#endif // OPENSCENARIO_INTERPRETER__PARAMETER_DISTRIBUTION_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <openscenario_interpreter/syntax/catalog_locations.hpp>
#include <openscenario_interpreter/syntax/entity.hpp>
#include <openscenario_interpreter/utility/demangle.hpp>
#include <random>
#include <unordered_map>
#include <utility>
#include <vector>
Expand Down Expand Up @@ -192,7 +193,8 @@ class Scope

std::list<Entity> actors;

double seed; // NOTE: `seed` is used only for sharing randomSeed in Stochastic now
// NOTE: `random_engine` is used only for sharing random number generator in Stochastic now
std::default_random_engine random_engine;

Scope() = delete;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef OPENSCENARIO_INTERPRETER__DETERMINISTIC_HPP_
#define OPENSCENARIO_INTERPRETER__DETERMINISTIC_HPP_
#ifndef OPENSCENARIO_INTERPRETER__SYNTAX__DETERMINISTIC_HPP_
#define OPENSCENARIO_INTERPRETER__SYNTAX__DETERMINISTIC_HPP_

#include <openscenario_interpreter/parameter_distribution.hpp>
#include <openscenario_interpreter/scope.hpp>
#include <openscenario_interpreter/syntax/deterministic_parameter_distribution.hpp>
#include <pugixml.hpp>
Expand All @@ -23,21 +24,25 @@ namespace openscenario_interpreter
{
inline namespace syntax
{
/* ---- Deterministic 1.2 ------------------------------------------------------
*
* <xsd:complexType name="Deterministic">
* <xsd:sequence>
* <xsd:group ref="DeterministicParameterDistribution" minOccurs="0" maxOccurs="unbounded"/>
* </xsd:sequence>
* </xsd:complexType>
*
* -------------------------------------------------------------------------- */
struct Deterministic
/*
Deterministic (OpenSCENARIO XML 1.3)

Top level container containing all deterministic distribution elements.

<xsd:complexType name="Deterministic">
<xsd:sequence>
<xsd:group ref="DeterministicParameterDistribution" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
*/
struct Deterministic : public ParameterDistributionContainer
{
const std::list<DeterministicParameterDistribution> deterministic_parameter_distributions;

explicit Deterministic(const pugi::xml_node &, Scope & scope);

auto derive() -> ParameterDistribution override;
};
} // namespace syntax
} // namespace openscenario_interpreter
#endif // OPENSCENARIO_INTERPRETER__DETERMINISTIC_HPP_
#endif // OPENSCENARIO_INTERPRETER__SYNTAX__DETERMINISTIC_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef OPENSCENARIO_INTERPRETER__DETERMINISTIC_MULTI_PARAMETER_DISTRIBUTION_HPP_
#define OPENSCENARIO_INTERPRETER__DETERMINISTIC_MULTI_PARAMETER_DISTRIBUTION_HPP_
#ifndef OPENSCENARIO_INTERPRETER__SYNTAX__DETERMINISTIC_MULTI_PARAMETER_DISTRIBUTION_HPP_
#define OPENSCENARIO_INTERPRETER__SYNTAX__DETERMINISTIC_MULTI_PARAMETER_DISTRIBUTION_HPP_

#include <openscenario_interpreter/scope.hpp>
#include <openscenario_interpreter/syntax/deterministic_multi_parameter_distribution_type.hpp>
Expand All @@ -23,19 +23,24 @@ namespace openscenario_interpreter
{
inline namespace syntax
{
/* ---- DeterministicMultiParameterDistribution 1.2 ----------------------------
*
* <xsd:complexType name="DeterministicMultiParameterDistribution">
* <xsd:sequence>
* <xsd:group ref="DeterministicMultiParameterDistributionType"/>
* </xsd:sequence>
* </xsd:complexType>
*
* -------------------------------------------------------------------------- */
struct DeterministicMultiParameterDistribution : public DeterministicMultiParameterDistributionType
/*
DeterministicMultiParameterDistribution (OpenSCENARIO XML 1.3)

Container for a deterministic distribution which is applied to multiple parameters.

<xsd:complexType name="DeterministicMultiParameterDistribution">
<xsd:sequence>
<xsd:group ref="DeterministicMultiParameterDistributionType"/>
</xsd:sequence>
</xsd:complexType>
*/
struct DeterministicMultiParameterDistribution : public DeterministicMultiParameterDistributionType,
public ParameterDistributionContainer
{
explicit DeterministicMultiParameterDistribution(const pugi::xml_node &, Scope & scope);

auto derive() -> ParameterDistribution override;
};
} // namespace syntax
} // namespace openscenario_interpreter
#endif // OPENSCENARIO_INTERPRETER__DETERMINISTIC_MULTI_PARAMETER_DISTRIBUTION_HPP_
#endif // OPENSCENARIO_INTERPRETER__SYNTAX__DETERMINISTIC_MULTI_PARAMETER_DISTRIBUTION_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef OPENSCENARIO_INTERPRETER__DETERMINISTIC_MULTI_PARAMETER_DISTRIBUTION_TYPE_HPP_
#define OPENSCENARIO_INTERPRETER__DETERMINISTIC_MULTI_PARAMETER_DISTRIBUTION_TYPE_HPP_
#ifndef OPENSCENARIO_INTERPRETER__SYNTAX__DETERMINISTIC_MULTI_PARAMETER_DISTRIBUTION_TYPE_HPP_
#define OPENSCENARIO_INTERPRETER__SYNTAX__DETERMINISTIC_MULTI_PARAMETER_DISTRIBUTION_TYPE_HPP_

#include <openscenario_interpreter/scope.hpp>
#include <openscenario_interpreter/syntax/value_set_distribution.hpp>
Expand All @@ -23,24 +23,22 @@ namespace openscenario_interpreter
{
inline namespace syntax
{
/* ---- DeterministicMultiParameterDistributionType 1.2 ------------------------
*
* <xsd:group name="DeterministicMultiParameterDistributionType">
* <xsd:sequence>
* <xsd:element name="ValueSetDistribution" type="ValueSetDistribution"/>
* </xsd:sequence>
* </xsd:group>
*
* -------------------------------------------------------------------------- */
/*
DeterministicMultiParameterDistributionType (OpenSCENARIO XML 1.3)

A deterministic distribution type which can be applied to multiple parameters.

<xsd:group name="DeterministicMultiParameterDistributionType">
<xsd:sequence>
<xsd:element name="ValueSetDistribution" type="ValueSetDistribution"/>
</xsd:sequence>
</xsd:group>
*/
struct DeterministicMultiParameterDistributionType : public ValueSetDistribution
{
explicit DeterministicMultiParameterDistributionType(const pugi::xml_node &, Scope & scope);
};

//DEFINE_LAZY_VISITOR(
// DeterministicMultiParameterDistributionType,
// CASE(ValueSetDistribution), //
//);
} // namespace syntax
} // namespace openscenario_interpreter
#endif // OPENSCENARIO_INTERPRETER__DETERMINISTIC_MULTI_PARAMETER_DISTRIBUTION_TYPE_HPP_
#endif // OPENSCENARIO_INTERPRETER__SYNTAX__DETERMINISTIC_MULTI_PARAMETER_DISTRIBUTION_TYPE_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef OPENSCENARIO_INTERPRETER__DETERMINISTIC_PARAMETER_DISTRIBUTION_HPP_
#define OPENSCENARIO_INTERPRETER__DETERMINISTIC_PARAMETER_DISTRIBUTION_HPP_
#ifndef OPENSCENARIO_INTERPRETER__SYNTAX__DETERMINISTIC_PARAMETER_DISTRIBUTION_HPP_
#define OPENSCENARIO_INTERPRETER__SYNTAX__DETERMINISTIC_PARAMETER_DISTRIBUTION_HPP_

#include <openscenario_interpreter/scope.hpp>
#include <openscenario_interpreter/syntax/deterministic_multi_parameter_distribution.hpp>
Expand All @@ -24,18 +24,18 @@ namespace openscenario_interpreter
{
inline namespace syntax
{
/* ---- DeterministicParameterDistribution 1.2 ---------------------------------
*
* <xsd:group name="DeterministicParameterDistribution">
* <xsd:choice>
* <xsd:element name="DeterministicMultiParameterDistribution"
* type="DeterministicMultiParameterDistribution"/>
* <xsd:element name="DeterministicSingleParameterDistribution"
* type="DeterministicSingleParameterDistribution"/>
* </xsd:choice>
* </xsd:group>
*
* -------------------------------------------------------------------------- */
/*
DeterministicParameterDistribution (OpenSCENARIO XML 1.3)

Either a DeterministicMultiParameterDistribution or a DeterministicSingleParameterDistribution

<xsd:group name="DeterministicParameterDistribution">
<xsd:choice>
<xsd:element name="DeterministicMultiParameterDistribution" type="DeterministicMultiParameterDistribution"/>
<xsd:element name="DeterministicSingleParameterDistribution" type="DeterministicSingleParameterDistribution"/>
</xsd:choice>
</xsd:group>
*/
struct DeterministicParameterDistribution : public Group
{
explicit DeterministicParameterDistribution(const pugi::xml_node &, Scope & scope);
Expand All @@ -48,4 +48,4 @@ DEFINE_LAZY_VISITOR(
);
} // namespace syntax
} // namespace openscenario_interpreter
#endif // OPENSCENARIO_INTERPRETER__DETERMINISTIC_PARAMETER_DISTRIBUTION_HPP_
#endif // OPENSCENARIO_INTERPRETER__SYNTAX__DETERMINISTIC_PARAMETER_DISTRIBUTION_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef OPENSCENARIO_INTERPRETER__DETERMINISTIC_SINGLE_PARAMETER_DISTRIBUTION_HPP_
#define OPENSCENARIO_INTERPRETER__DETERMINISTIC_SINGLE_PARAMETER_DISTRIBUTION_HPP_
#ifndef OPENSCENARIO_INTERPRETER__SYNTAX__DETERMINISTIC_SINGLE_PARAMETER_DISTRIBUTION_HPP_
#define OPENSCENARIO_INTERPRETER__SYNTAX__DETERMINISTIC_SINGLE_PARAMETER_DISTRIBUTION_HPP_

#include <openscenario_interpreter/scope.hpp>
#include <openscenario_interpreter/syntax/deterministic_single_parameter_distribution_type.hpp>
Expand All @@ -23,23 +23,28 @@ namespace openscenario_interpreter
{
inline namespace syntax
{
/* ---- DeterministicSingleParameterDistribution 1.2 ---------------------------
*
* <xsd:complexType name="DeterministicSingleParameterDistribution">
* <xsd:sequence>
* <xsd:group ref="DeterministicSingleParameterDistributionType"/>
* </xsd:sequence>
* <xsd:attribute name="parameterName" type="String" use="required"/>
* </xsd:complexType>
*
* -------------------------------------------------------------------------- */
/*
DeterministicSingleParameterDistribution (OpenSCENARIO XML 1.3)

Container for a deterministic distribution which is applied to a single parameter.

<xsd:complexType name="DeterministicSingleParameterDistribution">
<xsd:sequence>
<xsd:group ref="DeterministicSingleParameterDistributionType"/>
</xsd:sequence>
<xsd:attribute name="parameterName" type="String" use="required"/>
</xsd:complexType>
*/
struct DeterministicSingleParameterDistribution
: public DeterministicSingleParameterDistributionType
: public DeterministicSingleParameterDistributionType,
public ParameterDistributionContainer
{
const String parameter_name;

explicit DeterministicSingleParameterDistribution(const pugi::xml_node &, Scope &);

auto derive() -> ParameterDistribution override;
};
} // namespace syntax
} // namespace openscenario_interpreter
#endif // OPENSCENARIO_INTERPRETER__DETERMINISTIC_SINGLE_PARAMETER_DISTRIBUTION_HPP_
#endif // OPENSCENARIO_INTERPRETER__SYNTAX__DETERMINISTIC_SINGLE_PARAMETER_DISTRIBUTION_HPP_
Loading
Loading