21 nlohmann::ordered_json jsonObject;
24 jsonObject[
"decision"] =
"choice";
29 jsonObject[
"choices"] = nlohmann::ordered_json();
31 for (
size_t i = 0; i < extensionElements->choices.size(); i++) {
32 auto attribute = extensionElements->choices[i]->attribute;
33 if ( !
choices[i].has_value() ) {
34 jsonObject[
"choices"][attribute->name] = nullptr ;
36 else if ( attribute->type ==
BOOLEAN) {
37 bool value = (bool)
choices[i].value();
38 jsonObject[
"choices"][attribute->name] = value ;
40 else if ( attribute->type ==
INTEGER) {
41 int value = (int)
choices[i].value();
42 jsonObject[
"choices"][attribute->name] = value ;
44 else if ( attribute->type ==
DECIMAL) {
45 double value = (double)
choices[i].value();
46 jsonObject[
"choices"][attribute->name] = value ;
48 else if ( attribute->type ==
STRING) {
50 jsonObject[
"choices"][attribute->name] = value ;
54 jsonObject[
"choices"][attribute->name] = value ;
59 jsonObject[
"evaluation"] = (double)
evaluation.value();
Represents an abstract base class for a pending decision.
std::optional< double > evaluation
Latest evaluation or null if decision has not been evaluated or evaluation is no longer valid.
void determineDependencies(const std::set< const BPMNOS::Model::Attribute * > &dependencies)
Represents an abstract base class for a pending Evaluator.
virtual std::optional< double > evaluate(EntryDecision *decision)=0
virtual std::set< const BPMNOS::Model::Attribute * > getDependencies(EntryDecision *decision)=0
const BPMN::Process * process
Pointer to the top-level process.
Represents a token running through a (sub)process.
const BPMN::FlowNode * node
const StateMachine * owner
State machine owning the token.
SharedValues * data
Pointer to the data of the owner or owned state machine subprocesses)
Class holding extension elements representing execution data for nodes.
std::unique_ptr< ExtensionElements > extensionElements
std::string id
Id of element.
std::string to_string(number numericValue, const ValueType &type)
Converts a number to a string.
nlohmann::ordered_json jsonify() const override
std::optional< double > evaluate() override
Evaluates the reward for the decision. Returns null if decision is infeasible.
ChoiceDecision(const Token *token, Values choices, Evaluator *evaluator)
Represents the event that choices are made for a DecisionTask.
static constexpr size_t Instance