# News-vendor problem#

class inventory#

Stochastic Programming Test Problem: An Inventory Model.

This problem is a generalization of the simple inventory problem so-called of the “news-vendor”, widely used to introduce the main tools and techniques of stochastic programming Assume you are a newsvendor and each week, for the next $$N$$ weeks, you need to decide how many journals to order (indicated with the decision variable $$x_i$$). The weekly journal demand is unknown to you and is indicated with the variable $$d_i$$. The cost of ordering journals before the week starts is $$c$$, the cost of ordering journals during the week (in order to meet an unforeseen demand) is $$b$$ and the cost of having to hold unsold journals is $$h$$. The inventory level of journals will be defined by the succession:

$I_i = [I_{i-1} + x_i - d_i]_+, I_1 = 0$
while the total cost of running the journal sales for $$N$$ weeks will be:
$J(\mathbf x, \mathbf d) = c \sum_{i=1}^N x_i+ b \sum_{i=1}^N [d_i - I_i - x_i]_+ + h \sum_{i=1}^N [I_i + x_i - d_i]_+$

See: www2.isye.gatech.edu/people/faculty/Alex_Shapiro/SPbook.pdf

Public Functions

inline inventory(unsigned weeks = 4u, unsigned sample_size = 10u, unsigned seed = pagmo::random_device::next())#

Constructor from weeks, sample size and random seed.

Given the number of weeks (i.e. prolem dimension), the sample size to approximate the expected value and a starting random seed, we construct the inventory prolem

Parameters
• weeks – dimension of the problem corresponding to the number of weeks to plan the inventory for.

• sample_size – dimension of the sample used to approximate the expected value

• seed – starting random seed to build the pseudorandom sequences used to generate the sample

vector_double fitness(const vector_double&) const#

Fitness computation.

Computes the fitness for this UDP

Parameters

x – the decision vector.

Returns

the fitness of x.

std::pair<vector_double, vector_double> get_bounds() const#

Box-bounds.

It returns the box-bounds for this UDP.

Returns

the lower and upper bounds for each of the decision vector components

inline void set_seed(unsigned seed)#

Sets the seed.

Parameters

seed – the random number generator seed

inline std::string get_name() const#

Problem name.

Returns

a string containing the problem name

std::string get_extra_info() const#

Extra info.

Returns

a string containing extra info on the problem