|
| 1 | +# MoDS Simple Agent |
| 2 | +This agent is able to access a limited amount of the functionality of [the Model Development Suite (MoDS)](https://cmclinnovations.com/solutions/products/mods/). |
| 3 | + |
| 4 | +## Deployment |
| 5 | +This agent is currently deployed at `https://kg.cmclinnovations.com/mods-agent` however if you require local deployment you can follow the following instructions. |
| 6 | + |
| 7 | +Login to [TWA repo](https://github.com/cambridge-cares/TheWorldAvatar) using the following command using a token with read (and write if developing) access. |
| 8 | +```bash |
| 9 | +docker login ghcr.io/cambridge-cares |
| 10 | +``` |
| 11 | +To deploy the MoDS Simple Agent a `.lic` licence file is required to be placed in the [`secrets`](./secrets/) directory. |
| 12 | +Running the following command will spin up the MoDS Simple Agent at port `58085`. |
| 13 | +```bash |
| 14 | +docker compose up -d |
| 15 | +``` |
| 16 | + |
| 17 | +## Usage |
| 18 | +Example input files can be found in the [`examples`](./examples) directory. |
| 19 | +To submit a job via curl or a web browser use https://kg.cmclinnovations.com/mods-agent/request (remote on KG server) or http://localhost:58085/request (local), with a "`query`" parameter with a value (URL-encoded if working through a browser) similar to these input files. |
| 20 | +For example click [here](https://kg.cmclinnovations.com/mods-agent/request?query=%7B%22SimulationType%22%3A%22MOOonly%22%2C%22Algorithms%22%3A%5B%7B%22name%22%3A%22algorithm1%22%2C%22type%22%3A%22GenSurrogateAlg%22%2C%22surrogateToLoad%22%3A%22example-surrogate%22%7D%2C%7B%22name%22%3A%22algorithm2%22%2C%22type%22%3A%22MOO%22%2C%22maxNumberOfResults%22%3A10%2C%22variables%22%3A%5B%7B%22name%22%3A%22var1%22%2C%22type%22%3A%22input%22%7D%2C%7B%22name%22%3A%22var2%22%2C%22type%22%3A%22input%22%7D%2C%7B%22name%22%3A%22var3%22%2C%22type%22%3A%22input%22%7D%2C%7B%22name%22%3A%22var4%22%2C%22type%22%3A%22output%22%2C%22objective%22%3A%22Maximise%22%2C%22minimum%22%3A0.5%2C%22weight%22%3A0.5%7D%2C%7B%22name%22%3A%22var5%22%2C%22type%22%3A%22output%22%2C%22objective%22%3A%22Minimise%22%2C%22maximum%22%3A1.5%2C%22weight%22%3A0.1%7D%2C%7B%22name%22%3A%22var6%22%2C%22type%22%3A%22output%22%2C%22objective%22%3A%22Maximise%22%2C%22minimum%22%3A2.5%2C%22weight%22%3A0.7%7D%5D%7D%5D%7D) to run a the job specified in the [multi-objective optimisation with pregenerated surrogate example](./examples/MOOonly.json). |
| 21 | + |
| 22 | +Some `SimulationType`s will be returned the results of the simulation immediately in a JSON object. |
| 23 | +- Multi-Criteria Decision Making (`MCDM`) |
| 24 | +- Sensitivity Analysis (`Sensitivity`) |
| 25 | + |
| 26 | +Others will return only return a the "jobID" and the "SimulationType" in a JSON object and run asynchronously. |
| 27 | +- High-Dimensional Model Representation Surrogate Generation (`HDMR`) |
| 28 | +- Surrogate Generation and Multi-Objective Optimisation (`MOO`) |
| 29 | +- Multi-Objective Optimisation with a pregenerated saved surrogate (`MOOonly`) |
| 30 | +- Evaluation of a pregenerated saved surrogate (`Evaluate`) |
| 31 | +The JSON object returned by this query (URL-encoded if working through a browser) can then be passed as the "`query`" parameter to this URL https://kg.cmclinnovations.com/mods-agent/output/request (remote on KG server) or http://localhost:58085/output/request (local) to retrieve the results when the simulation is complete. |
| 32 | + |
| 33 | +The MoDS Simple Agent supports the loading and saving of surrogates generated. |
| 34 | +In the examples an "`example-surrogate`" is loaded using `"surrogateToLoad": "example-surrogate"`. |
| 35 | +This field can be replace with the `jobID` of a previous job where `"saveSurrogate": true`. |
| 36 | + |
| 37 | +## Development |
| 38 | +Add the following files to the [`credentials`](./credentials/) directory. |
| 39 | +- `cmcl_repo_username.txt` username for nexus on bradman repo |
| 40 | +- `cmcl_repo_password.txt` password for nexus on bradman repo |
| 41 | +- `wa_repo_username.txt` username for into [TWA repo](https://github.com/cambridge-cares/TheWorldAvatar) |
| 42 | +- `wa_repo_password.txt` password (or preferably token) for [TWA repo](https://github.com/cambridge-cares/TheWorldAvatar) |
0 commit comments