Table of Contents

Client - Submit Simulation Results

Back to JEA API docs


When the exploration process of a project is running, JEA will generate a set of candidate solutions during each iteration (“generation”). The client program is responsible for evaluating the solutions, usually by applying the parameter values to simulation cases and running the simulations, and submitting the results back to JEA. This process involves two operations: getting the cases (“jobs”) that are awaiting evaluation, and submitting the results once simulations are done.

The Submit Simulation Results operation sends the set of results to JEA. A valid JWT token must be included in the header, or the transaction will be rejected with an HTTP 401 Unauthorized error code.

Synopsis

Simulation Results

An example of the simulation results object to be submitted to the JEA engine is shown below. It is identified by its name and projectName, corresponding to those received in the Simulation Jobs object. The resultSet is a map between case IDs and the results maps. A cpuTime value can also be set to record the amount of computing resource used in simulating this set of jobs.


{
  "name": "Gen-11",
  "projectName": "circle",
  "resultSet": {
    "C-26_27": {
      "f1": 26,
      "f2": 27
    },
    "C-3_5": {
      "f1": 3,
      "f2": 5
    },
    "C-16_17": {
      "f1": 16,
      "f2": 17
    },
    "C-31_0": {
      "f1": 31,
      "f2": 0
    }
  },
  "cpuTime": "0"
}

Engine Response

Result of the operation is returned as an engine response object as seen in the example here:

{
  "description": "Evaluation results set.",
  "ok": true
}

If the name field does not match the current pending jobs, or the submitted results covers only part of the expected cases, the response may be:

{
  "description": "Evaluation results set. Further results expected: 10",
  "ok": true
}

If the projectName does not match with the project running on JEA, the response may be:

{
  "description":"Cannot find project circle11 to which the results reference. Results discarded.",
  "ok":false
}

Example using curl://

To send the Project Data command using curl:

curl -b cookies  -X POST -d '{...}' https://api.ensims.com/jea_web/api/eval

On successful operation, a Engine Response object is returned. If the existing JWT is invalid, an HTTP 401 Unauthorized code will be returned.

Example using Python Requests

Make sure Requests is correctly installed in your Python environment, and run the following the lines:

import requests

body = {  "name": "Gen-11",
  "projectName": "circle",
  "resultSet": {
    "C-26_27": {
      "f1": 26,
      "f2": 27
    },
    "C-3_5": {
      "f1": 3,
      "f2": 5
    },
    "C-16_17": {
      "f1": 16,
      "f2": 17
    },
    "C-31_0": {
      "f1": 31,
      "f2": 0
    }
  },
  "cpuTime": "0"
}

# Get the awaiting cases of the 'circle' project 

# Make a request with the stored cookies from the log on transaction
r = requests.post('https://api.ensims.com/jea_web/api/eval', cookies=cookies)
  
r.json()