Nextmv CLI is a command line interface that you can use to interact with Nextmv.
To display more information about a command, use the help
command or one of the help global flags: --help
, -h
.
Available commands
Available commands and their corresponding subcommands. You can navigate to each section to learn more about the specific command.
Command | Description | Subcommands |
---|---|---|
app | Manage and interact with applications you create. | create , delete , get , list , list-versions , promote , push , result , run |
completion | Generate auto-completion script for a specified shell. | bash , fish , powershell , zsh |
configure | Setup Nextmv CLI. | |
help | Display help. | |
private | Manage and interact with the Nextmv private cloud environment. | bootstrap , configure , get-release , keys , list-releases |
sdk | Install dev tools, initialize optimization templates and run models locally | init , install , run |
update | Update Nextmv CLI. | |
version | Print the version of Nextmv CLI. |
Global Flags
Global flags that can be added to any command.
Flag | Description |
---|---|
-c , --config string | Full path to config file. |
-h , --help | Get help for command. |
-c
, --config
This flag instructs the command to use the config file that is passed to it instead of the standard configuration file created with nextmv configure
(though note that the existing configuration file is not modified in any way). Here is an example using the sdk run
command:
-h
, --help
This flag displays the help menu.
You can also display the help for the specified command or subcommand. Here is an example using the version
command:
activate
command
The activate
command is used to re-activate the token for extension of the local free trial. Re-activation will only succeed for eligible users. In case of any questions or issues, please contact support.
app
command
The app
command manages and interacts with applications that you push and run in Nextmv Cloud. This feature is currently in public beta. Please contact support to request access.
completion
command
The completion
command generates the autocompletion script for the Nextmv CLI for the specified shell.
Here is an example on displaying the completion
for zsh
:
configure
command
The configure
command adds or modifies your Nextmv API key for use with the Nextmv CLI. Running this command will create a config.yaml
file (or modify it if already present) in the directory where your nextmv
binary is located. Note that the base API endpoint will be set automatically with the default value when you pass your API key with the --api-key
flag. This command is typically run once.
These are the available flags for the configure
command:
Flag | Description |
---|---|
-a , --api-key string | Nextmv API key. |
-s , --show | Prints the current configuration. |
Here is an example where the configure
command is used to update the Nextmv API key with an environment variable.
help
command
The help
command displays the main help menu.
You can use help
to display the help menu for any specified command or subcommand.
Here is an example where the help
command is used to display the help for the sdk run
command:
go
command
The go
command provides a passthrough to the Nextmv-managed Go toolchain.
private
command
The private
command manages and interacts with the Nextmv private cloud environment.
These are the available subcommands of the private
command:
Subcommand | Description |
---|---|
bootstrap | Bootstrap the environment. Learn more here. |
configure | Configures the private cloud environment. Learn more here. |
get-release | Gets a private cloud release. Learn more here. |
keys | Keys commands. Learn more here. |
list-releases | Lists the available private cloud releases. Learn more here. |
private bootstrap
command
The private bootstrap
command bootstraps a new default admin configuration. A service url should be provided.
private configure
command
The private configure
command configures a private cloud environment.
These are the available flags for the private configure
command:
Flag | Description |
---|---|
-a , --apikey string | The API key used to make calls to the Nextmv private cloud. |
-e , --endpoint string | The host endpoint, e.g.: my.private.cloud.io:8402 . |
private get-release
command
The private get-release
command gets an installable release for a private deployment.
These are the available flags for the private get-release
command:
Flag | Description |
---|---|
-o , --output string | The directory to install to (default current). |
private keys
command
The private keys
command manages the private cloud keys.
These are the available subcommands of the private keys
command:
Subcommand | Description |
---|---|
create | Creates a new key. |
deactivate | Deactivates a key. |
list | List API keys info. |
reactivate | Reactivates a key. |
private keys create
command
The private keys create
command creates a new key for admin and non-admin (applications).
These are the available flags for the private keys create
command:
Flag | Description |
---|---|
-a , --admin | boolean |
-n , --name string | API key name. |
private keys deactivate
command
The private keys deactivate
command deactivates an enabled API key.
These are the available flags for the private keys deactivate
command:
Flag | Description |
---|---|
-a , --admin | boolean |
-n , --name string | API key name. |
private keys list
command
The private keys list
command lists API keys info.
These are the available flags for the private keys list
command:
Flag | Description |
---|---|
-a , --all | All keys, including disabled ones. |
private keys reactivate
command
The private keys reactivate
command reactivates a disabled API key.
These are the available flags for the private keys reactivate
command:
Flag | Description |
---|---|
-a , --admin | boolean |
-n , --name string | API key name. |
private list-releases
command
The private list-releases
command lists releases for private cloud.
sdk
command
The sdk
command suite contains commands for downloading and using Nextmv plugins for local development.
These are the available subcommands for the sdk
command:
Subcommand | Description |
---|---|
init | Initialize a new Nextmv template. Learn more here. |
install | Installs Nextmv plugin dependencies. Learn more here |
run | Run app locally. Learn more here. |
init
subcommand
The init
subcommand initializes a new Nextmv template. A template is a ready-to-run application that solves a decision automation problem.
Available templates
Focus Area | Template | Description |
---|---|---|
vehicle routing | routing | Solves a vehicle routing problem (VRP), using the Nextmv Router Engine. The template includes a complete list of options that can easily be configured to solve most routing problems. |
cloud-routing | Solves a vehicle routing problem (VRP), using a different input structure than the template above that exposes constraints via the input file. This template is the basis for the Nextmv routing app. | |
routing-matrix-input | A modeling kit for vehicle routing problems (VRP). This template shows how to use a custom matrix that is passed via an input file | |
measure-matrix | Serves as an input generator for the routing-matrix-input app. The generated input data includes matrices for distance and travel time | |
time-dependent-measure | Makes use of time dependent measures and applies different costs according to time. | |
unique-matrix-measure | Reduce input file size by limiting the stop matrix to just unique points. | |
clustering | cluster | Groups a set of data points into clusters, where each cluster is a collection of points that are similar to one another in some way. |
cluster-tsp | Creates a set of clusters equal to the number of vehicles, in a pre-processing step, then solves a TSP for each vehicle. | |
packing | knapsack | Maximizes the total value without exceeding the weight capacity of the knapsack, given a collection of items with a value and weight. |
mip-knapsack | Solves the knapsack problem using Mixed Integer Programming and the open-source solver HiGHS. | |
scheduling | shift-scheduling | Assigns one worker to each shift while maximizing worker happiness score and covering all shifts with as few workers as possible. |
pager-duty | Assigns users to shifts (days) for incident response on-call duty using input and output data structures compatible with PagerDuty API. | |
custom | new-app | Provides a skeleton with guidance on how to utilize store to create a completely custom model. |
puzzle | sudoku | Fills a 9x9 grid such that all columns and all 3x3 subgrids contain the numerals 1 through 9. |
allocation | mip-meal-allocation | Allocates meals (diets) to bunnies with the goal of maximizing their happiness through good diets and nutrition. This template uses the open-source solver HiGHS. |
For a more in depth understanding of how to use each of these templates, visit the SDK reference page.
These are the available flags for the init
subcommand:
Flag | Description |
---|---|
-d , --directory string | The directory in which to initialize the template. |
-t , --template string | The type of Nextmv template you wish to generate. |
Here is an example where the init
subcommand is used to generate the knapsack
template.
After initializing the template, you can use the tree
command to check the contents of the knapsack
dir:
install
subcommand
The install
subcommand downloads the latest version of the SDK shared object files (or the version specified, if given) and the Nextmv-managed Go executable for your architecture.
These are the available flags for the install
subcommand:
Flag | Description |
---|---|
-r , --root string | The GOROOT used. |
Here is an example where the install
subcommand is used to check that all the necessary files and the Nextmv-managed Go executable are already installed:
run
subcommand
- It is best practice to set a duration limit when running locally. Do this by passing the
-- -limits.duration
flag. You can read more about solver flags here. - When running a Nextmv application, if no input path is given, you may provide input via stdin.
The run
subcommand allows you to compile and run custom code consuming the Nextmv SDK.
These are the available flags for the run
subcommand:
Flag | Description |
---|---|
-d , --debug-flags | If set, this will insert -gcflags='all=-N -l' and -tags=debug to Go for debugging Nextmv applications. |
-r , --root string | The GOROOT used. |
Runner and solver options are passed using --
.
Here is an example where the sdk init
and sdk run
commands are used to run the routing
template. The input is read from the input.json
file and the output is saved to an output.json
file.
update
command
The update
command updates the Nextmv CLI. If the version is not specified, it will update to the latest one.
version
command
The version
command prints the Nextmv CLI version.
Runner and solver options
All applications are configurable through the following options.
- Runner options change how the runner outputs solutions. For instance,
-runner.output.solutions
default oflast
will only output the final improving solution in a decision automation model. - Solver options change how many states are allowed in a diagram, how many states it pulls from the search queue, termination criteria, and randomization.
Options can be configured as CLI flags or environment variables. To set an environment variable, convert its corresponding CLI flag to uppercase, replacing each period (.
) with an underscore (_
) and removing the leading dash (-
). For example:
-limits.solutions
is equivalent to LIMITS_SOLUTIONS
.
If both an environment variable and its corresponding CLI flag are defined, the CLI flag will overwrite the environment variable.
CLI Flag | Environment Variable | Default | Description |
---|---|---|---|
-runner.input.path string | RUNNER_INPUT_PATH | - | Path to input file. |
-runner.output.path string | RUNNER_OUTPUT_PATH | - | Path to which output file should be written. |
-runner.output.quiet | RUNNER_OUTPUT_QUIET | null | Only output solutions. |
-runner.output.solutions string | RUNNER_OUTPUT_SOLUTIONS | last | Solutions to display: all , last - |
-runner.output.stream | RUNNER_OUTPUT_STREAM | null | Stream the output. |
-runner.profile.cpu string | RUNNER_PROFILE_CPU | null | File for CPU profile. |
-runner.profile.memory string | RUNNER_PROFILE_MEMORY | null | File for memory profile. |
-diagram.expansion.limit int | DIAGRAM_EXPANSION_LIMIT | 0 | Diagram expansion limit. |
-diagram.width int | DIAGRAM_WIDTH | 10 | Diagram width. |
-limits.duration duration | LIMITS_DURATION | 168h | Time limit, e.g. 10ms . |
-limits.nodes int | LIMITS_NODES | model.MaxInt | Node limit. |
-limits.solutions int | LIMITS_SOLUTIONS | model.MaxInt | Solution limit. |
-pool.size int | POOL_SIZE | 0 | Pool size (only used by specific engines). |
-random.seed int | RANDOM_SEED | 0 | Random seed. |
-search.buffer int | SEARCH_BUFFER | 100 | Solution buffer (0 = none). |
Solver options are automatically marshaled into model output in the options
section of the JSON.
LIMITS_DURATION
should be set to a non-zero value in production i.e. 1h
or 1m30s
. Valid time units are as follows, according to time.ParseDuration from Go's standard library.
- ns (nanoseconds)
- us/µs (microseconds)
- ms (milliseconds)
- s (seconds)
- m (minutes)
- h (hours)
The POOL_SIZE
variable is only used by specific engines, e.g. the fleet engine. In the specific case of the fleet engine, the larger value of runtime.GOMAXPROCS(0) / 2
and 1
overrides the POOL_SIZE
default value.