The cost flow app is available in one modeling language as a network flow problem. You can also choose to make customizations to the model by instantiating the app first.
- OR-Tools
- Marketplace subscription app IDs
- Python:
nextmv-cost.flow.ortools
- Python:
- Marketplace subscription app IDs
Once you have the code locally, you can customize the model, run it locally and deploy it to Nextmv Platform.
Input
The input schema is a JSON payload defining nodes of the network with their supply (negative supply equals a demand) as well as the edges between nodes. Nextmv's tools are designed to operate directly on business data (in JSON) to produce decisions that are actionable by software systems. This makes decisions more interpretable and easier to test. It also makes integration with data warehouses and business intelligence platforms significantly easier. An input contains the following components:
| Field name | Required | Data type | SI Unit | Description | Example |
|---|---|---|---|---|---|
projects | Yes | array of project | NA | The list of available projects. | See project |
workers | Yes | array of worker | NA | A list of all available workers to fulfill the projects. | See worker |
Project
| Field name | Required | Data type | SI Unit | Description | Example |
|---|---|---|---|---|---|
id | Yes | string | NA | The ID of the project. | {"id": "project_1"} |
required_skills | Yes | array of string | NA | A list of skills required for this project. | {"required_skills": ["programming"]} |
value | Yes | float | NA | The value of the project. | {"value": 100} |
required_time | Yes | float | NA | The required time to fulfill this project. | {"required_time": 2} |
Worker
| Field name | Required | Data type | SI Unit | Description | Example |
|---|---|---|---|---|---|
id | Yes | string | NA | The ID of the worker. | {"id": "worker_1"} |
skills | Yes | float | NA | A list of skills the worker can offer. | {"skills": ["programming"]} |
available_time | Yes | map | NA | The number of time units this worker is available. | {"available_time": 3 |
Here you can find a sample .json with the input schema:
Output
The output schema defines the solution to the order fulfillment problem in JSON format. The output schema contains the following components.
| Field name | Always present | Data type | SI Unit | Description | Example |
|---|---|---|---|---|---|
solution | Yes | array of solution | NA | Solutions to the order fulfillment problem. | See solution |
statistics | Yes | statistics | NA | Summary statistics of the solution. | {"statistics": {"total_cost": 123}} |
Solution
| Field name | Always present | Data type | SI Unit | Description | Example |
|---|---|---|---|---|---|
flows | No | array of flow | NA | A list of all the flows in the solution, including flows to and from the dummy source and the dummy sink nodes. | See flow |
assignments | No | array of assignment | NA | A list of actual assignments between workers and projects; translates the flows into the context of the use case. | See assignment |
status | No | string | NA | The status of the solution | {"status": "optimal"} |
total_value_of_fulfilled_projects | No | int | NA | The total value of all the projects that could be fully staffed by workers. | {"value": 123} |
Flow
| Field name | Always present | Data type | SI Unit | Description | Example |
|---|---|---|---|---|---|
from | No | int | NA | Index of start node of the flow. | {"from": 123} |
to | No | int | NA | Index of the end node of the flow. | {"to": 1} |
flow | No | int | NA | Number of time units in this flow. | {"flow": 123} |
capacity | No | int | NA | Original capacity between the start and the end node. | {"capacity": 123} |
value | No | int | NA | Project value that is realized with this flow. | {"value": 123} |
Assignment
| Field name | Always present | Data type | SI Unit | Description | Example |
|---|---|---|---|---|---|
project | No | string | NA | The project id of the project in this assignment. | {"project": "project_1"} |
worker | No | string | NA | The worker id of the worker in this assignment. | {"worker": "worker_1"} |
value | No | int | NA | The the realized project value of this assignment. | {"value": 123} |
time_units | No | int | NA | The utilized time units of the worker to fulfill the indicated project. | {"capacity": 123} |
Statistics
| Field name | Always present | Data type | SI Unit | Description | Example |
|---|---|---|---|---|---|
result | No | result | NA | Final result of the solutions. | See result |
run | Yes | run | NA | Information about the run. | See run |
schema | Yes | string | NA | Schema of the statistics. | {"schema": "v1"} |
Here you can find additional definitions used in the statistics schema:
resultField name Always present Data type SI Unit Description Example durationYes floatsecondsTime duration to get to the final result. {"duration": 0.123}valueYes floatNA Value of the final result. {"value": 0.123}customYes anyNA Custom solver metrics. See customrunField name Always present Data type SI Unit Description Example durationYes floatsecondsTime duration of the run. {"duration": 0.123}customField name Always present Data type SI Unit Description Example number_of_edgesYes intNA Number of edges in the network that is constructed based on the input. {"number_of_edges": 123}number_of_nodesYes intNA Number of nodes in the network that is constructed based on the input. {"number_of_nodes": 123}number_of_workersYes intNA Number of workers in the input. {"number_of_workers": "optimal"}number_of_projectsYes intNA Number of projects in the input. {"number_of_projects": 123}available_time_unitsYes intNA Number of time units offered by the workers. {"available_time_units": 123}required_time_unitsYes intNA Number of time units required by the projects. {"required_time_units": 123}excess_time_unitsYes intNA Number of time units in excess of the demand. {"excess_time_units": 123}unmet_time_unitsYes intNA Number of time units that can't be fulfilled by the workers. {"unmet_time_units": 123}number_of_fulfilled_projectsYes intNA Number of projects that could be completely fulfilled by the workers. {"number_of_fulfilled_projects": 123}number_of_unfulfilled_projectsYes intNA Number of projects that could not be completely fulfilled by the workers. {"number_of_unfulfilled_projects": 123}
Run options
These are the default options that are available with cost flow model.