Pricing range
A pricing range defines the amount of fare prices, the min-max range of prices, and the fare identifications.
RangeModel
dataclass
Bases: PricingModel
Dataclass for pricing range parameters.Parameters specifying .
Parameters:
Name | Type | Description | Default |
---|---|---|---|
granularity | int | Number of fares | required |
min_fare | int | Price per seat of the lowest fare | required |
max_fare | int | Price per seat of the highest fare | required |
tags | List[str] | List of single-character identifiers for all fares. Defaults | required |
Example
range = RangeModel(granularity=4, min_fare=40, max_fare=200, tags=["D", "C", "B", "A"])
Source code in src/rmlab/data/parametric/pricing_range.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
|
make_pricing_range_from_json(filename_or_dict)
Make a pricing range instance from a json representation (from file or dict).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filename_or_dict | Union[str, dict] | JSON filename or dictionary in json format | required |
Examples from dict:
dict_range = {"granularity": 3, "min_fare": 40, "max_fare": 200}
my_pricing_range = make_from_json(dict_range)
# Tags will be ["Q", "P", "O"] from lowest to highest price per seat
dict_range = {"granularity": 3, "min_fare": 40, "max_fare": 200, tags=["C", "B", "A"]}
my_pricing_range = make_from_json(dict_range)
dict_range = {"granularity": 3, "min_fare": 40, "max_fare": 200, lowest_tag="Q"}
my_pricing_range = make_from_json(dict_range)
# Tags will be ["Q", "P", "O"] from lowest to highest price per seat
dict_range = {"granularity": 10, "min_fare": 40, "max_fare": 200, highest_tag="A"}
my_pricing_range = make_from_json(dict_range)
# Tags will be ["C", "B", "A"] from lowest to highest price per seat
Example from file: my_pricing_range.json
{
"granularity" : 10,
"min_fare" : 40,
"max_fare" : 500,
"lowest_tag" : "Q"
}
my_pricing_range = make_pricing_range_from_json("my_pricing_range.json")
Source code in src/rmlab/data/parametric/pricing_range.py
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
|