diff --git a/components/bpmn-q/test/tests/quantme/qrms/cutting/detector.bpmn b/components/bpmn-q/test/tests/quantme/qrms/cutting/detector.bpmn
new file mode 100644
index 00000000..97a8fec9
--- /dev/null
+++ b/components/bpmn-q/test/tests/quantme/qrms/cutting/detector.bpmn
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/bpmn-q/test/tests/quantme/qrms/cutting/replacement.bpmn b/components/bpmn-q/test/tests/quantme/qrms/cutting/replacement.bpmn
new file mode 100644
index 00000000..ae543659
--- /dev/null
+++ b/components/bpmn-q/test/tests/quantme/qrms/cutting/replacement.bpmn
@@ -0,0 +1,133 @@
+?xml version="1.0" encoding="UTF-8"?>
+
+
+
+
+ SequenceFlow_1h1q60o
+
+
+
+ POST
+
+
+ application/json
+ application/json
+
+
+ http://quokka-gateway:6474/quokka/circuit-cutting/combineResultsQuokka
+
+ import groovy.json.JsonBuilder
+println("Combining circuits");
+def counts = execution.getVariable("counts");
+println("Counts: " + counts.toString());
+def cuttingMetaData = execution.getVariable("cuttingMetaData");
+println("CuttingMetaData: " + cuttingMetaData.toString());
+def circuit = execution.getVariable("circuit")[0];
+
+def request = [:];
+request.put("circuit", circuit);
+request.put("subcircuit_results", counts);
+request.put("cuts", cuttingMetaData);
+request.put("unnormalized_results", "True");
+request.put("shot_scaling_factor", 1000);
+request.put("circuit_format", "qiskit");
+requeststring = new JsonBuilder(request).toPrettyString()
+println(requeststring);
+return requeststring;
+
+
+ def resp = connector.getVariable("response");
+resp = new groovy.json.JsonSlurperClassic().parseText(resp);
+println("Response with counts: " + resp.toString());
+def result = [resp.get("result")];
+println("Final result: " + result.toString());
+return result;
+
+
+ http-connector
+
+
+
+
+ SequenceFlow_1h1q60o
+
+
+
+ POST
+
+
+ application/json
+ application/json
+
+
+ http://quokka-gateway:6474/quokka/circuit-cutting/cutCircuits
+
+ import groovy.json.JsonBuilder
+println("Cutting circuits");
+def circuit = execution.getVariable("circuit")[0];
+def cuttingMethod = execution.getVariable("cuttingMethod");
+def maxSubCircuitWidth = execution.getVariable("maxSubCircuitWidth");
+if (maxSubCircuitWidth == null) {
+ maxSubCircuitWidth = 2;
+}
+maxSubCircuitWidth = maxSubCircuitWidth.toInteger();
+def maxNumberOfCuts = execution.getVariable("maxNumberOfCuts");
+if (maxNumberOfCuts == null) {
+ maxNumberOfCuts = 2;
+}
+maxNumberOfCuts = maxNumberOfCuts.toInteger();
+def maxNumSubCircuits = execution.getVariable("maxNumSubCircuits");
+if (maxNumSubCircuits == null) {
+ maxNumSubCircuits = 2;
+}
+maxNumSubCircuits = maxNumSubCircuits.toInteger();
+println("Building request...");
+
+def request = [:];
+request.put("circuit", circuit);
+request.put("method", "automatic");
+request.put("max_subcircuit_width", maxSubCircuitWidth);
+request.put("max_cuts", maxNumberOfCuts);
+request.put("max_num_subcircuits", maxNumSubCircuits);
+request.put("circuit_format", "qiskit");
+requeststring = new JsonBuilder(request).toPrettyString()
+println(requeststring);
+return requeststring;
+
+
+ def resp = connector.getVariable("response");
+resp = new groovy.json.JsonSlurperClassic().parseText(resp)
+println("Response with cuttingMetaData: " + resp.toString());
+return resp;
+
+
+ def resp = connector.getVariable("response");
+resp = new groovy.json.JsonSlurperClassic().parseText(resp)
+println("Response with subCircuits: " + resp.toString());
+def result = [:];
+result.put("subCircuits", resp.get("individual_subcircuits"));
+println("Final result: " + result.toString());
+return result;
+
+
+
+ http-connector
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/bpmn-q/test/tests/quantme/qrms/execution-openqasm/detector.bpmn b/components/bpmn-q/test/tests/quantme/qrms/execution-openqasm/detector.bpmn
new file mode 100644
index 00000000..75693eac
--- /dev/null
+++ b/components/bpmn-q/test/tests/quantme/qrms/execution-openqasm/detector.bpmn
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/bpmn-q/test/tests/quantme/qrms/execution-openqasm/replacement.bpmn b/components/bpmn-q/test/tests/quantme/qrms/execution-openqasm/replacement.bpmn
new file mode 100644
index 00000000..0ef4bea0
--- /dev/null
+++ b/components/bpmn-q/test/tests/quantme/qrms/execution-openqasm/replacement.bpmn
@@ -0,0 +1,91 @@
+
+
+
+
+
+
+
+ POST
+
+
+ application/json
+ application/json
+
+
+ http://quokka-gateway:6474/quokka/circuit-execution/execution-service
+
+
+import groovy.json.JsonBuilder
+ def qpu = execution.getVariable("qpu");
+ def circuit = execution.getVariable("circuit");
+ def token = execution.getVariable("token");
+ def gammas = execution.getVariable("gammas");
+ def betas = execution.getVariable("betas");
+ def optimizedParameters = execution.getVariable("optimizedParameters");
+ def credentials = [:];
+ credentials.put("token", token);
+ credentials.put("hub", "ibm-q");
+ credentials.put("group", "open")
+ credentials.put("project", "main");
+ credentials.put("url", "https://auth.quantum-computing.ibm.com/api");
+ def request = [:];
+ request.put("qpu", qpu);
+ request.put("credentials", credentials)
+ request.put("shots", 2000);
+ request.put("circuit", circuit);
+ request.put("circuit_format", "openqasm");
+ request.put("provider", "ibm");
+
+ requeststring = new JsonBuilder(request).toPrettyString()
+println(requeststring);
+ return requeststring;
+
+
+ def resp = connector.getVariable("response");
+resp = new groovy.json.JsonSlurperClassic().parseText(resp);
+println(resp);
+counts_array= [];
+for (el in resp){
+println(el);
+ counts_array.push(el.get('counts'));
+}
+println(counts_array);
+counts_array;
+
+
+ def resp = connector.getVariable("response");
+resp = new groovy.json.JsonSlurperClassic().parseText(resp);
+println(resp);
+meas_qubits_array = [];
+for (el in resp){
+ meas_qubits_array.push(el.get('meas_qubits'));
+}
+println(meas_qubits_array);
+return meas_qubits_array;
+
+
+ def resp = connector.getVariable("response");
+resp = new groovy.json.JsonSlurperClassic().parseText(resp)
+println(resp);
+transpiled_circuit_depth_array = [];
+for (el in resp){
+println(el);
+ transpiled_circuit_depth_array.push(el.get('transpiled_circuit_depth'));
+}
+println(transpiled_circuit_depth_array);
+return transpiled_circuit_depth_array;
+
+
+ http-connector
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/bpmn-q/test/tests/quantme/qrms/execution-parameterized/detector.bpmn b/components/bpmn-q/test/tests/quantme/qrms/execution-parameterized/detector.bpmn
new file mode 100644
index 00000000..8a3f41da
--- /dev/null
+++ b/components/bpmn-q/test/tests/quantme/qrms/execution-parameterized/detector.bpmn
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/bpmn-q/test/tests/quantme/qrms/execution-parameterized/replacement.bpmn b/components/bpmn-q/test/tests/quantme/qrms/execution-parameterized/replacement.bpmn
new file mode 100644
index 00000000..66acf257
--- /dev/null
+++ b/components/bpmn-q/test/tests/quantme/qrms/execution-parameterized/replacement.bpmn
@@ -0,0 +1,123 @@
+
+
+
+
+
+
+
+ POST
+
+
+ application/json
+ application/json
+
+
+ http://quokka-gateway:6474/quokka/circuit-execution/execution-service
+
+
+import groovy.json.JsonBuilder
+ def qpu = execution.getVariable("qpu");
+ def circuit = execution.getVariable("circuit");
+ def token = execution.getVariable("token");
+ def gammas = execution.getVariable("gammas");
+ def betas = execution.getVariable("betas");
+ def optimizedParameters = execution.getVariable("optimizedParameters");
+ def subCircuits = execution.getVariable("subCircuits");
+ if (subCircuits != null) {
+ println("Subcircuits: " + subCircuits.toString());
+ circuit = subCircuits.get("subCircuits");
+ println("Circuits after adding subcircuits: " + circuit.toString());
+ }
+ def credentials = [:];
+ credentials.put("token", token);
+ credentials.put("hub", "ibm-q");
+ credentials.put("group", "open")
+ credentials.put("project", "main");
+ credentials.put("url", "https://auth.quantum-computing.ibm.com/api");
+ def request = [:];
+ request.put("qpu", qpu);
+ request.put("credentials", credentials)
+ request.put("shots", 2000);
+ request.put("circuit", circuit);
+ request.put("circuit_format", "qiskit");
+ request.put("provider", "ibm");
+ if (optimizedParameters == null){
+
+ if (betas instanceof String) {
+ println("Parsing betas...");
+ betas = betas.drop(1).take(betas.length()-2).split(",");
+ execution.setVariable("betas", betas);
+ }
+
+ if (gammas instanceof String) {
+ println("Parsing gammas...");
+ gammas = gammas.drop(1).take(gammas.length()-2).split(",");
+ execution.setVariable("gammas", gammas);
+ }
+
+ optimizedParameters = betas + gammas;
+ } else {
+param_array=[];
+println(optimizedParameters);
+optimizedParameters=optimizedParameters.drop(1).take(optimizedParameters.length()-2);
+println(optimizedParameters);
+optimizedParameters= optimizedParameters.replaceAll("\\s","").split(",");
+println(optimizedParameters);
+optimizedParameters.each{ param->
+param_array.push(param.toDouble());}
+optimizedParameters=param_array;
+}
+ request.put("parameters", optimizedParameters);
+ requeststring = new JsonBuilder(request).toPrettyString()
+println(requeststring);
+ return requeststring;
+
+
+ def resp = connector.getVariable("response");
+resp = new groovy.json.JsonSlurperClassic().parseText(resp);
+println(resp);
+counts_array= [];
+for (el in resp){
+println(el);
+ counts_array.push(el.get('counts'));
+}
+println(counts_array);
+counts_array;
+
+
+ def resp = connector.getVariable("response");
+resp = new groovy.json.JsonSlurperClassic().parseText(resp);
+println(resp);
+meas_qubits_array = [];
+for (el in resp){
+ meas_qubits_array.push(el.get('meas_qubits'));
+}
+println(meas_qubits_array);
+return meas_qubits_array;
+
+
+ def resp = connector.getVariable("response");
+resp = new groovy.json.JsonSlurperClassic().parseText(resp)
+println(resp);
+transpiled_circuit_depth_array = [];
+for (el in resp){
+println(el);
+ transpiled_circuit_depth_array.push(el.get('transpiled_circuit_depth'));
+}
+println(transpiled_circuit_depth_array);
+return transpiled_circuit_depth_array;
+
+
+ http-connector
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/bpmn-q/test/tests/quantme/qrms/generate-maxcut/detector.bpmn b/components/bpmn-q/test/tests/quantme/qrms/generate-maxcut/detector.bpmn
new file mode 100644
index 00000000..e35d5086
--- /dev/null
+++ b/components/bpmn-q/test/tests/quantme/qrms/generate-maxcut/detector.bpmn
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/bpmn-q/test/tests/quantme/qrms/generate-maxcut/replacement.bpmn b/components/bpmn-q/test/tests/quantme/qrms/generate-maxcut/replacement.bpmn
new file mode 100644
index 00000000..97b63626
--- /dev/null
+++ b/components/bpmn-q/test/tests/quantme/qrms/generate-maxcut/replacement.bpmn
@@ -0,0 +1,69 @@
+
+
+
+
+
+
+
+ POST
+
+
+ application/json
+ application/json
+
+
+ http://quokka-gateway:6474/quokka/circuit-generation/algorithms/maxcutqaoa
+
+
+ import groovy.json.JsonBuilder
+ def adjMatrix = execution.getVariable("adjMatrix");
+
+ def request = [:];
+ request.put("adj_matrix", adjMatrix);
+ request.put("parameterized", "true");
+ request.put("p", 1);
+ if (execution.getVariable("wsBitstring") != null) {
+ request.put("initial_state", execution.getVariable("wsBitstring"));
+ }
+ requeststring = new JsonBuilder(request).toPrettyString()
+ return requeststring;
+
+
+
+
+def resp = connector.getVariable("response");
+resp = new groovy.json.JsonSlurper().parseText(resp)
+circuit= resp.get('circuit')
+println(circuit);
+return [circuit];
+
+
+
+def resp = connector.getVariable("response");
+resp = new groovy.json.JsonSlurper().parseText(resp)
+depth= resp.get('depth')
+println(depth);
+return depth;
+
+
+
+def resp = connector.getVariable("response");
+resp = new groovy.json.JsonSlurper().parseText(resp)
+n_qubits= resp.get('n_qubits')
+println(n_qubits);
+return n_qubits;
+
+
+ http-connector
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/bpmn-q/test/tests/quantme/qrms/generate-tsp/detector.bpmn b/components/bpmn-q/test/tests/quantme/qrms/generate-tsp/detector.bpmn
new file mode 100644
index 00000000..e11def80
--- /dev/null
+++ b/components/bpmn-q/test/tests/quantme/qrms/generate-tsp/detector.bpmn
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/bpmn-q/test/tests/quantme/qrms/generate-tsp/replacement.bpmn b/components/bpmn-q/test/tests/quantme/qrms/generate-tsp/replacement.bpmn
new file mode 100644
index 00000000..403784c7
--- /dev/null
+++ b/components/bpmn-q/test/tests/quantme/qrms/generate-tsp/replacement.bpmn
@@ -0,0 +1,70 @@
+
+
+
+
+
+
+
+ POST
+
+
+ application/json
+ application/json
+
+
+ http://quokka-gateway:6474/quokka/circuit-generation/algorithms/tspqaoa
+
+
+ import groovy.json.JsonBuilder
+ def adjMatrix = execution.getVariable("adjMatrix");
+ def gammas = execution.getVariable("gammas");
+ def betas = execution.getVariable("betas");
+
+ def request = [:];
+ request.put("adj_matrix", adjMatrix);
+ request.put("p", 1);
+ request.put("gammas", gammas);
+ request.put("betas", betas);
+
+ requeststring = new JsonBuilder(request).toPrettyString()
+ return requeststring;
+
+
+
+
+def resp = connector.getVariable("response");
+resp = new groovy.json.JsonSlurper().parseText(resp)
+circuit= resp.get('circuit')
+println(circuit);
+return [circuit];
+
+
+
+def resp = connector.getVariable("response");
+resp = new groovy.json.JsonSlurper().parseText(resp)
+depth= resp.get('depth')
+println(depth);
+return depth;
+
+
+
+def resp = connector.getVariable("response");
+resp = new groovy.json.JsonSlurper().parseText(resp)
+n_qubits= resp.get('n_qubits')
+println(n_qubits);
+return n_qubits;
+
+
+ http-connector
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/bpmn-q/test/tests/quantme/qrms/optimization/detector.bpmn b/components/bpmn-q/test/tests/quantme/qrms/optimization/detector.bpmn
new file mode 100644
index 00000000..a0e58635
--- /dev/null
+++ b/components/bpmn-q/test/tests/quantme/qrms/optimization/detector.bpmn
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/bpmn-q/test/tests/quantme/qrms/optimization/replacement.bpmn b/components/bpmn-q/test/tests/quantme/qrms/optimization/replacement.bpmn
new file mode 100644
index 00000000..e0a8092f
--- /dev/null
+++ b/components/bpmn-q/test/tests/quantme/qrms/optimization/replacement.bpmn
@@ -0,0 +1,153 @@
+
+
+
+
+
+ SequenceFlow_12iaeht
+
+
+ SequenceFlow_12iaeht
+ SequenceFlow_1ebfooz
+ SequenceFlow_1lffclo
+
+
+
+ SequenceFlow_1ebfooz
+ SequenceFlow_100xkhy
+ SequenceFlow_0jv1zhg
+
+
+ ${ execution.getVariable('iterations')!= null && execution.getVariable('iterations') >= 1}
+
+
+ ${ execution.getVariable('iterations')== null || execution.getVariable('iterations') < 1}
+
+
+
+
+ SequenceFlow_1hst7js
+
+
+
+
+
+
+ POST
+
+
+ application/json
+ application/json
+
+
+ http://quokka-gateway:6474/quokka/optimization/optimization-service
+
+
+ import groovy.json.JsonBuilder
+ def optimizer = execution.getVariable("optimizer");
+ def gammas = execution.getVariable("gammas");
+ def betas = execution.getVariable("betas");
+ def initialParameters = betas + gammas;
+ execution.setVariable("iterations", 0);
+
+ def request = [:];
+ request.put("topic", "12345");
+ request.put("optimizer", optimizer);
+ request.put("initialParameters", initialParameters);
+ requeststring = new JsonBuilder(request).toPrettyString();
+ return requeststring;
+
+
+
+
+ def iterations = connector.getVariable("iterations");
+ iterations = iterations + 1;
+ return iterations;
+
+
+
+ return "false";
+
+
+ http-connector
+
+
+ SequenceFlow_1lffclo
+ SequenceFlow_100xkhy
+
+
+
+
+
+ def iterations = execution.getVariable("iterations");
+ iterations = iterations + 1;
+ return iterations;
+
+
+
+
+ SequenceFlow_0jv1zhg
+ SequenceFlow_1hst7js
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/bpmn-q/test/tests/quantme/qrms/result-eval-maxcut/detector.bpmn b/components/bpmn-q/test/tests/quantme/qrms/result-eval-maxcut/detector.bpmn
new file mode 100644
index 00000000..c71a26a5
--- /dev/null
+++ b/components/bpmn-q/test/tests/quantme/qrms/result-eval-maxcut/detector.bpmn
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/bpmn-q/test/tests/quantme/qrms/result-eval-maxcut/replacement.bpmn b/components/bpmn-q/test/tests/quantme/qrms/result-eval-maxcut/replacement.bpmn
new file mode 100644
index 00000000..167dd359
--- /dev/null
+++ b/components/bpmn-q/test/tests/quantme/qrms/result-eval-maxcut/replacement.bpmn
@@ -0,0 +1,83 @@
+
+
+
+
+
+
+
+ POST
+
+
+ application/json
+ application/json
+
+
+ http://quokka-gateway:6474/quokka/objective-evaluation/objective/max-cut
+
+ import groovy.json.JsonBuilder
+ def adjMatrix = execution.getVariable("adjMatrix");
+ def mitigatedCounts = execution.getVariable("mitigatedCounts");
+ def counts = execution.getVariable("counts")[0];
+ def objFun = execution.getVariable("objectiveFunction");
+
+ if (mitigatedCounts != null) {
+ counts = mitigatedCounts
+ }
+
+ def request = [:];
+ request.put("visualization", "True" )
+ request.put("adj_matrix", adjMatrix);
+ request.put("counts", counts);
+ request.put("objFun", objFun);
+
+ def objFun_hyperparameters = [:]
+ if (execution.getVariable("alpha") != null){
+ objFun_hyperparameters.put("alpha", execution.getVariable("alpha"));
+ }
+ if (execution.getVariable("eta") != null){
+ objFun_hyperparameters.put("eta", execution.getVariable("eta"));
+ }
+ request.put("objFun_hyperparameters", objFun_hyperparameters);
+
+ execution.setVariable("plotUrl", "http://localhost:8090/engine-rest/process-instance/" + execution.getProcessInstanceId() + "/variables/maxCutPlot/data");
+
+ requeststring = new JsonBuilder(request).toPrettyString()
+ return requeststring;
+
+
+ def resp = connector.getVariable("response");
+resp = new groovy.json.JsonSlurper().parseText(resp)
+objValue= resp.get('objective_value')
+println("obj values:" + objValue.toString());
+return objValue.toDouble();
+
+
+ def resp = connector.getVariable("response");
+resp = new groovy.json.JsonSlurperClassic().parseText(resp)
+costs= resp.get('costs')
+println(costs);
+return costs;
+
+
+ import org.camunda.bpm.engine.variable.value.FileValue
+ import org.camunda.bpm.engine.variable.Variables
+ import groovy.json.JsonSlurper
+ def slurper = new JsonSlurper().parseText(response)
+ String filename = "plot.png";
+ FileValue typedFileValue = Variables.fileValue(filename).file(slurper.visualization.decodeBase64()).mimeType("application/png").create()
+typedFileValue
+
+
+ http-connector
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/bpmn-q/test/tests/quantme/qrms/result-eval-tsp/detector.bpmn b/components/bpmn-q/test/tests/quantme/qrms/result-eval-tsp/detector.bpmn
new file mode 100644
index 00000000..5d06048c
--- /dev/null
+++ b/components/bpmn-q/test/tests/quantme/qrms/result-eval-tsp/detector.bpmn
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/bpmn-q/test/tests/quantme/qrms/result-eval-tsp/replacement.bpmn b/components/bpmn-q/test/tests/quantme/qrms/result-eval-tsp/replacement.bpmn
new file mode 100644
index 00000000..81ddcd35
--- /dev/null
+++ b/components/bpmn-q/test/tests/quantme/qrms/result-eval-tsp/replacement.bpmn
@@ -0,0 +1,83 @@
+
+
+
+
+
+
+
+ POST
+
+
+ application/json
+ application/json
+
+
+ http://quokka-gateway:6474/quokka/objective-evaluation/objective/tsp
+
+ import groovy.json.JsonBuilder
+ def adjMatrix = execution.getVariable("adjMatrix");
+ def mitigatedCounts = execution.getVariable("mitigatedCounts");
+ def counts = execution.getVariable("counts")[0];
+ def objFun = execution.getVariable("objectiveFunction");
+
+ if (mitigatedCounts != null) {
+ counts = mitigatedCounts
+ }
+
+ def request = [:];
+ request.put("visualization", "True" )
+ request.put("adj_matrix", adjMatrix);
+ request.put("counts", counts);
+ request.put("objFun", objFun);
+
+ def objFun_hyperparameters = [:]
+ if (execution.getVariable("alpha") != null){
+ objFun_hyperparameters.put("alpha", execution.getVariable("alpha"));
+ }
+ if (execution.getVariable("eta") != null){
+ objFun_hyperparameters.put("eta", execution.getVariable("eta"));
+ }
+ request.put("objFun_hyperparameters", objFun_hyperparameters);
+
+ execution.setVariable("plotUrl", "http://localhost:8090/engine-rest/process-instance/" + execution.getProcessInstanceId() + "/variables/tspPlot/data");
+
+ requeststring = new JsonBuilder(request).toPrettyString()
+ return requeststring;
+
+
+ def resp = connector.getVariable("response");
+resp = new groovy.json.JsonSlurper().parseText(resp)
+objValue= resp.get('objective_value')
+println("obj values:" + objValue.toString());
+return objValue.toDouble();
+
+
+ def resp = connector.getVariable("response");
+resp = new groovy.json.JsonSlurperClassic().parseText(resp)
+costs= resp.get('costs')
+println(costs);
+return costs;
+
+
+ import org.camunda.bpm.engine.variable.value.FileValue
+ import org.camunda.bpm.engine.variable.Variables
+ import groovy.json.JsonSlurper
+ def slurper = new JsonSlurper().parseText(response)
+ String filename = "plot.png";
+ FileValue typedFileValue = Variables.fileValue(filename).file(slurper.visualization.decodeBase64()).mimeType("application/png").create()
+typedFileValue
+
+
+ http-connector
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/bpmn-q/test/tests/quantme/qrms/vqa-max-cut/detector.bpmn b/components/bpmn-q/test/tests/quantme/qrms/vqa-max-cut/detector.bpmn
new file mode 100644
index 00000000..a2cb4c55
--- /dev/null
+++ b/components/bpmn-q/test/tests/quantme/qrms/vqa-max-cut/detector.bpmn
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/bpmn-q/test/tests/quantme/qrms/vqa-max-cut/replacement.bpmn b/components/bpmn-q/test/tests/quantme/qrms/vqa-max-cut/replacement.bpmn
new file mode 100644
index 00000000..ab339024
--- /dev/null
+++ b/components/bpmn-q/test/tests/quantme/qrms/vqa-max-cut/replacement.bpmn
@@ -0,0 +1,157 @@
+
+
+
+
+
+ Flow_0by5v25
+
+
+ Flow_0by5v25
+ Flow_1m6lop6
+
+
+ Flow_1m6lop6
+ Flow_0kctuf9
+
+
+ Flow_0kctuf9
+ Flow_1m5mc3w
+
+ Flow_0dx8uvu
+
+
+ Flow_0dx8uvu
+ Flow_0lk6f27
+ Flow_0s0dowc
+
+
+
+
+ Flow_0s0dowc
+ Flow_01b9wf1
+
+
+
+ Flow_01b9wf1
+ Flow_1aw5wvc
+
+
+ Flow_1aw5wvc
+ Flow_0hfu1ms
+ Flow_15vu28i
+
+
+
+ Flow_0hfu1ms
+
+
+ ${ execution.getVariable('converged')!= null && execution.getVariable('converged') == 'true'}
+
+
+ Flow_15vu28i
+ Flow_0lk6f27
+
+
+ ${ execution.getVariable('converged')== null || execution.getVariable('converged') == 'false'}
+
+
+
+
+ Flow_1m5mc3w
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/bpmn-q/test/tests/quantme/qrms/vqa-tsp/detector.bpmn b/components/bpmn-q/test/tests/quantme/qrms/vqa-tsp/detector.bpmn
new file mode 100644
index 00000000..384d2177
--- /dev/null
+++ b/components/bpmn-q/test/tests/quantme/qrms/vqa-tsp/detector.bpmn
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/bpmn-q/test/tests/quantme/qrms/vqa-tsp/replacement.bpmn b/components/bpmn-q/test/tests/quantme/qrms/vqa-tsp/replacement.bpmn
new file mode 100644
index 00000000..19573f88
--- /dev/null
+++ b/components/bpmn-q/test/tests/quantme/qrms/vqa-tsp/replacement.bpmn
@@ -0,0 +1,384 @@
+
+
+
+
+
+ Flow_09t6nnu
+
+
+
+
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+ YOUR_TOKEN
+ aer_qasm_simulator
+
+
+ Flow_0mzl7oh
+ Flow_0wx9oos
+
+ Flow_0o4z2bu
+ Flow_02rkbcc
+
+
+ Flow_16m2h8a
+ Flow_1n228bz
+
+
+ Flow_0lcb2k8
+ Flow_16m2h8a
+
+
+ Flow_1fw8qr1
+
+
+ Flow_1n228bz
+ Flow_0o4z2bu
+ Flow_0z90hsf
+
+
+ Flow_02rkbcc
+ Flow_0o2bb7x
+ Flow_0n7fw20
+
+
+ Flow_0ptfzy6
+
+
+ Flow_0ptfzy6
+ Flow_1hcw6br
+ def allCities = execution.getVariable("allCities");
+ def currentDestinations = execution.getVariable("currentDestinations");
+ def distanceMatrix = execution.getVariable("distanceMatrix");
+ def durationMatrix = execution.getVariable("durationMatrix");
+
+if (currentDestinations.size() ==2 ){
+currentDestinations.push("Hannover");
+}
+
+ def requiredIndizes = []
+ for (def i in 0..allCities.size()-1) {
+ if (currentDestinations.contains(allCities[i])){
+ requiredIndizes.push(i)
+ }
+ }
+
+ def submatrixOfDistanceMatrix = new Integer [requiredIndizes.size()] [requiredIndizes.size()];
+ def submatrixOfDurationMatrix = new Float [requiredIndizes.size()] [requiredIndizes.size()];
+ for (def i in 0..requiredIndizes.size()-1) {
+ submatrixOfDistanceMatrix [i][i] = 0;
+ submatrixOfDurationMatrix [i][i] = 0.0;
+ for (def j in i+1..requiredIndizes.size()-1) {
+ if (j < requiredIndizes.size()){
+ submatrixOfDistanceMatrix [i][j] = distanceMatrix[requiredIndizes[i]][requiredIndizes[j]];
+ submatrixOfDistanceMatrix [j][i] = distanceMatrix[requiredIndizes[j]][requiredIndizes[i]];
+ submatrixOfDurationMatrix [j][i] = durationMatrix[requiredIndizes[j]][requiredIndizes[i]];
+ submatrixOfDurationMatrix [j][i] = durationMatrix[requiredIndizes[j]][requiredIndizes[i]];
+ }
+ }
+ }
+println(submatrixOfDistanceMatrix);
+ // switch between distance and duration depending on reqs
+ execution.setVariable("adjMatrix", submatrixOfDistanceMatrix);
+
+
+ Flow_1hcw6br
+ Flow_0o2bb7x
+ Flow_09usmoi
+
+
+ Flow_0j9m0xt
+ Flow_10bggd9
+ Flow_1fw8qr1
+
+
+ Flow_0n7fw20
+ Flow_0lcb2k8
+
+
+ Flow_0z90hsf
+ Flow_0j9m0xt
+ def currentDestinations = execution.getVariable("currentDestinations");
+def evaluatedCosts = execution.getVariable("evaluatedCosts");
+
+
+evaluatedCosts = evaluatedCosts[0].get("bitstring");
+println(evaluatedCosts);
+
+// route_array = new String [currentDestinations.size()];
+route_array = [];
+char_array = evaluatedCosts.toCharArray()
+
+for (i in 0..currentDestinations.size()-1){
+ route_array.push(currentDestinations[char_array[(i * currentDestinations.size())..(i * currentDestinations.size()+ currentDestinations.size())-1].findIndexOf {it == '1'}]);
+}
+println(route_array);
+
+
+execution.setVariable("currentRoute", route_array);
+
+
+
+ Flow_09usmoi
+ Flow_10bggd9
+ def currentDestinations = execution.getVariable("currentDestinations");
+
+execution.setVariable("currentRoute", currentDestinations.getClass().newInstance(currentDestinations));
+
+
+
+ ${ (execution.getVariable('converged')== null || execution.getVariable('converged') == 'false') && (execution.getVariable('iterations')== null || execution.getVariable('iterations') <=10)}
+
+
+
+
+
+
+
+ ${ (execution.getVariable('converged')!= null && execution.getVariable('converged') == 'true') || (execution.getVariable('iterations')!= null && execution.getVariable('iterations') >10) }
+
+
+ currentDestinations=execution.getVariable('currentDestinations');
+return !(currentDestinations.size() >4 && execution.getVariable('qpu')=="aer_qasm_simulator");
+
+
+
+
+
+ currentDestinations=execution.getVariable('currentDestinations');
+return (currentDestinations.size() >4 && execution.getVariable('qpu')=="aer_qasm_simulator");
+
+
+
+
+
+ Flow_09t6nnu
+ Flow_0mzl7oh
+ Flow_1dcw31l
+
+
+ Flow_0wx9oos
+ Flow_1hg6fer
+ Flow_05cz7fi
+
+
+ Flow_1dcw31l
+ Flow_1hg6fer
+ def currentDestinations = execution.getVariable("currentDestinations");
+
+execution.setVariable("currentRoute", currentDestinations.getClass().newInstance(currentDestinations));
+
+
+
+ currentDestinations=execution.getVariable('currentDestinations');
+return currentDestinations.size() >2;
+
+
+
+ currentDestinations=execution.getVariable('currentDestinations');
+return currentDestinations.size() <= 2;
+
+
+
+
+ Flow_05cz7fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/bpmn-q/test/tests/quantme/qrms/warm-start/detector.bpmn b/components/bpmn-q/test/tests/quantme/qrms/warm-start/detector.bpmn
new file mode 100644
index 00000000..6d96c85c
--- /dev/null
+++ b/components/bpmn-q/test/tests/quantme/qrms/warm-start/detector.bpmn
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/bpmn-q/test/tests/quantme/qrms/warm-start/replacement.bpmn b/components/bpmn-q/test/tests/quantme/qrms/warm-start/replacement.bpmn
new file mode 100644
index 00000000..d9b7ee38
--- /dev/null
+++ b/components/bpmn-q/test/tests/quantme/qrms/warm-start/replacement.bpmn
@@ -0,0 +1,90 @@
+
+
+
+
+
+
+
+ POST
+
+
+ application/json
+ application/json
+
+
+ http://quokka-gateway:6474/quokka/warm-starting/initialStateMaxCut
+
+ import groovy.json.JsonBuilder
+println("Start Warmstarting");
+def matrix = execution.getVariable("adjMatrix");
+
+if (matrix instanceof String) {
+ println("Received matrix of type string: " + matrix);
+ matrix = matrix.drop(1).take(matrix.length()-2);
+ matrix= matrix.replaceAll("\\s","").split("\\],\\[");
+ println("Separated matrix: " + matrix.toString());
+
+ new_matrix = []
+ for (el in matrix){
+ def current_array = el.replaceAll("\\[","").replaceAll("\\]","")
+ println("Current array: " + current_array.toString());
+ new_arr = [];
+ def numbers = current_array.split(",");
+ println("Numbers: " + numbers.toString());
+
+ for (number in numbers){
+ new_arr.push(number.toDouble());
+ }
+ new_matrix.push(new_arr);
+ }
+
+ matrix = new_matrix;
+ println("Matrix after parsing: " + matrix.toString());
+ execution.setVariable("adjMatrix", matrix);
+}
+
+def request = [:];
+request.put("graph", matrix);
+if (execution.getVariable("classicalAlgorithm") != null){
+ request.put("classicalAlgorithm", execution.getVariable("classicalAlgorithm"));
+}
+if (execution.getVariable("repetitions") != null){
+ request.put("repetitions", execution.getVariable("repetitions"));
+}
+if (execution.getVariable("rounded") != null){
+ request.put("rounded", execution.getVariable("rounded"));
+}
+requeststring = new JsonBuilder(request).toPrettyString()
+println(requeststring);
+return requeststring;
+
+
+ def resp = connector.getVariable("response");
+resp = new groovy.json.JsonSlurper().parseText(resp)
+println("Response to extract wsBitstring: " + resp.toString());
+wsBitstring= resp.get('bitstring')
+println(wsBitstring);
+return wsBitstring;
+
+
+ def resp = connector.getVariable("response");
+resp = new groovy.json.JsonSlurper().parseText(resp)
+println("Response to extract wsValue: " + resp.toString());
+wsValue= resp.get('value')
+println(wsValue);
+return wsValue;
+
+
+ http-connector
+
+
+
+
+
+
+
+
+
+
+
+