Get started with Nextmv
Build a decision model in 5 minutes
1Install & configure Nextmv CLI
Execute the following command in your terminal to download and install Nextmv CLI.
export NEXTMV_API_KEY=<YOUR_NEXTMV_CLOUD_API_KEY> export NEXTMV_BASE_URL=https://api.cloud.nextmv.io curl -sS "https://cloud.nextmv.io/install-cli.txt" | bash -Copy
After downloading and installing, configure the CLI installation with your account:
You’re now ready to start using the CLI and install Nextmv SDK.
2Install Nextmv SDK
With Nextmv CLI, install Nextmv SDK with:
This will install Go and get the necessary plugins and other supporting files needed to build and run your model locally. Note that Nextmv SDK manages its own Go installation and will not affect your current Go installation if you have one.
You’re now ready to create your first project.
3Initialize a new project using a template
With Nextmv CLI, initialize a new project with the Sudoku template:
This will create a new directory “sudoku” in your current working directory. Change into to this new sudoku directory:
There are several files in this newly created directory. The
main.go file contains all of the code for the Sudoku model and the
input.json contains the sample input for the model (a matrix containing a starting grid for a sudoku problem).
In the next step you’ll run the sudoku model using the
input.json file for the model input.
4Run the model locally
With Nextmv CLI, run your newly created sudoku model:
nextmv sdk run main.go -- \ -runner.input.path input.json \ -limits.duration 3s \ -diagram.expansion.limit 1 \ -runner.output.path output.jsonCopy
This command runs the model (
main.go ) specifying
input.json as the model input, and
output.json as where to store the model output. Running this command will create a new file in the current directory called
5View the results
output.json file in your code editor to view the results of your model. Among the solver options and statistics you should see a
store field with an array of arrays. This is your model’s solution to the sudoku problem (see formatted version below).
[ [7, 4, 8, 9, 1, 6, 5, 3, 2], [1, 5, 9, 3, 2, 7, 6, 8, 4], [3, 2, 6, 8, 5, 4, 7, 1, 9], [5, 9, 3, 2, 6, 8, 4, 7, 1], [2, 1, 4, 5, 7, 3, 9, 6, 8], [6, 8, 7, 1, 4, 9, 3, 2, 5], [4, 3, 1, 7, 8, 5, 2, 9, 6], [8, 7, 5, 6, 9, 2, 1, 4, 3], [9, 6, 2, 4, 3, 1, 8, 5, 7] ]Copy
Try changing the
input.json file and re-running the model to see what kind of result you get. (You can leave off the
-runner.output.path flag if you want to the model output to appear directly in the terminal.)
These steps can also be repeated with any of the other templates (like routing). To see a list of available templates, run: