Further options when specifying the model
You can pass the following optional keyword arguments in the definition of a newsvendor model NVModel(demand [; kwargs]):
costfor a unit; defaults to0pricefor selling a unit; defaults to0salvagevalue obtained from scraping a leftover unit; defaults to0holdingcost obtained from a leftover unit, e.g., extra captial cost or warehousing cost; essentially a negative salvage value; defaults to0backorderpenalty for being short a unit, e.g., contractual penalty for missing delivery targets or missed future profit of an unserved customer; defaults to0substitutebenefit received from selling to an unserved customer, e.g., when selling another product or serving in the future; essentially a negative backorder penalty; defaults to0fixcostfixed cost of operations; defaults to0q_minminimal feasible quantity, e.g., due to production limits; must be nonnegative; defaults to0q_maxmaximal feasible quantity, e.g., due to production limits; must be greater than or equal toq_min; defaults toInf
Example
Define a newsvendor problem with unit cost 5, unit price 7, normal demand around 50 with standard deviation 20, where a unit salvages for 0.5, and back order incurs at a penalty of 2 per unit, as follows:
julia> nvm2 = NVModel(cost = 5, price = 7, demand = Normal(50, 20), salvage = 0.5, backorder = 2)
Data of the Newsvendor Model
* Demand distribution: Normal{Float64}(μ=50.0, σ=20.0)
* Unit cost: 5.00
* Unit selling price: 7.00
* Unit salvage value: 0.50
* Unit backorder penalty: 2.00Note that cost, price, and demand are necessary arguments that can be passed without keyword. Moreover, only values that differ from the default value will be shown in the REPL. For instance, adding q_min=0 does not have an impact.
julia> nvm3 = NVModel(demand = Normal(50, 20), cost = 5, price = 7, salvage = 0.5, backorder = 2, q_min=0)
Data of the Newsvendor Model
* Demand distribution: Normal{Float64}(μ=50.0, σ=20.0)
* Unit cost: 5.00
* Unit selling price: 7.00
* Unit salvage value: 0.50
* Unit backorder penalty: 2.00julia> nvm3 == nvm2
true