NS3 ModelModel
Overview
The model encapsulates all the information required by the solver and can be thought of as “an instance of the problem to be solved”. The data within the model context should be relevant to the same problem being solved. For example, if the nodes defined in the model do not correspond to the nodes used by the lane rates or cost models then the model is invalid and will be rejected by the solver.
Applicable models
- NS3
ns3-tbfvuwtge2iq
Model
The model defines an instance of the desired problem to be solved.
Schema definition
message Model {
repeated Dimension dimensions = 1;
repeated Node nodes = 2;
repeated LaneRate laneRates = 3;
repeated CostModel costModels = 4;
repeated ProductGroup productGroups = 5;
}Fields
- dimensions
- The dimensions of the specified model. This may include user-defined dimensions as well as internal dimensions (such as road network distance and time).
- nodes
- The list of nodes for the specified model. The nodes should be uniquely defined. A model should also, at a minimum, contain at least one production and one consumption node (if you’ve got a use case where this isn’t needed, drop us a mail!).
- laneRates
- A list of lane rates which connect nodes in the model. Lane rates typically determine the cost to move products between nodes.
- costModels
- A list of cost models which connect source nodes to all consumption nodes in the model. Cost models are typically used to approximate secondary costs from warehouses or distribution centers to consumption locations.
- productGroups
- A list of product group definitions for the model. The list should identify each product used by the nodes and the product group to which it belongs (even if it belongs to its own product group).
Examples
This is a subset of a larger sample which can be found in the examples repo. The example defines a single product Beer which is produced at Guiness Storehouse. Two warehouses are available for distribution in Limerick and Galway, which have cost models defining their distribution cost to consumption nodes.
dimensions {
timeConfig {
id: "time"
measurementUnit: HOURS
}
distanceConfig {
id: "distance"
measurementUnit: KILOMETRES
}
userDimensions {
id: "weight"
units: "unknown"
}
}
nodes {
id: "Guiness Storehouse"
geocode {
longitude: -6.28655
latitude: 53.34161
}
production {
id: "Beer"
dimensionRanges {
dimensionId: "weight"
minRange: 0
maxRange: 10000
flowPenalty: 0
}
}
}
nodes {
id: "Galway Warehouse"
geocode {
longitude: -9.03500748
latitude: 53.3023
}
}
nodes {
id: "Limerick Warehouse"
geocode {
longitude: -8.57021618
latitude: 52.6429
}
}
nodes {
id: "1"
geocode {
longitude: -6.26393
latitude: 53.4318504
}
consumption {
id: "Beer"
dimensionRanges {
dimensionId: "weight"
minRange: 20
maxRange: 20
flowPenalty: 1e+06
}
}
allowableSources: "Guiness Storehouse"
allowableSources: "Galway Warehouse"
allowableSources: "Limerick Warehouse"
}
nodes {
id: "2"
geocode {
longitude: -6.25276184
latitude: 53.3501892
}
consumption {
id: "Beer"
dimensionRanges {
dimensionId: "weight"
minRange: 45
maxRange: 45
flowPenalty: 1e+06
}
}
allowableSources: "Guiness Storehouse"
allowableSources: "Galway Warehouse"
allowableSources: "Limerick Warehouse"
}
laneRates {
id: "lr:Guiness Storehouse->Galway Warehouse"
source: "Guiness Storehouse"
destination: "Galway Warehouse"
unitDimensionCosts {
dimensionIds: "distance"
dimensionCoefficients: 1
costPerUnit: 0.1
}
}
laneRates {
id: "lr:Guiness Storehouse->Limerick Warehouse"
source: "Guiness Storehouse"
destination: "Limerick Warehouse"
unitDimensionCosts {
dimensionIds: "distance"
dimensionCoefficients: 1
costPerUnit: 0.1
}
}
costModels {
id: "costmodel: Guiness Storehouse:Beer"
source: "Guiness Storehouse"
productGroupIds: "Beer"
unitDimensionCost {
dimensionIds: "distance"
dimensionCoefficients: 1
costPerUnit: 0.2
}
}
costModels {
id: "costmodel: Galway Warehouse:Beer"
source: "Galway Warehouse"
productGroupIds: "Beer"
unitDimensionCost {
dimensionIds: "distance"
dimensionCoefficients: 1
costPerUnit: 0.2
}
}
costModels {
id: "costmodel: Limerick Warehouse:Beer"
source: "Limerick Warehouse"
productGroupIds: "Beer"
unitDimensionCost {
dimensionIds: "distance"
dimensionCoefficients: 1
costPerUnit: 0.2
}
}
productGroups {
product: "Beer"
productGroup: "Beer"
}