Use Cases

advertisement
Use Cases
Inventory Policy Optimizer - Variator
1 Initialization
1.1 Trigger
Unconditionally triggered when Variator starts. (Command-line version). In GUI version, it is triggered
interactively by user.
1.2 Pre-conditions
No other instant of Variator that shares the same communication files is in progress.
1.3 Outcome
1.
2.
3.
4.
5.
Starting time is recorded to track the elapse time over generation
Parameter variables are initialized
Initial population is generated and stored
Communication file _ini (initial population data) is created
State is set to 1 if complete the above tasks successfully, state is set to 0 otherwise.
1.4 Normal Scenario Actions
1. Set state=0 (Initializing).
2. Verify the validity of command line parameters (Command-line version) or the validity of run
parameters input by user (GUI version).
3. Read parameters from configuration files
4. Verify the validity of parameter files and parameter values.
5. Initialize internal parameter variables
6. Generate initial population based on initialization strategy parameter
a. Random initialization
b. First 5 individuals represent the extreme stock policies, the remaining individuals are
randomly generated.
7. Calculate objective vectors of initial individuals
8. Create communication file _ini
9. Set state=1
1.5 Possible Exceptions



Invalid command line parameters (count, value)
Missing parameter files
Other instant of Variator is in progress and sharing the same communication files (state ∈
(2,3)).
2 Iteration
2.1 Trigger
State is 2 (set by Selector, indicating Selector has created the communication files _sel and _arc
successfully).
2.2 Pre-conditions
1. Communication files _sel (parents) and _arc (rejected) are created (by Selector)
2. Parameter variables are initialized
2.3 Outcome
1. If termination conditions are met, terminate iteration loop and create final output files, else
2. If report interval is met, generate an interval report
3. Evolution operators (cross-over and mutation) are performed to generate new individuals for
the next generation
4. Population is updated
5. Communication file _var is created
6. Status is set to 3 if complete the above tasks successfully, status is set to 4 if iteration is
terminated.
2.4 Actions
1. Idle until state 2 is read from sta file (set by Selector)
2. If report interval is reached, generate interval report files (section 6)
3. If iteration termination conditions are met, perform termination procedure (section 7)
Else,
4. Perform Evolution (Section 3)
2.5 Exceptions
Abnormal state is read from _sta file (State 6: Selector terminates, State 10: Selector resets).
3 Evolution
3.1 Trigger
Called by Iteration (section 2)
3.2 Pre-conditions
1. Communication files _sel (parents) and _arc (rejected) are created (by Selector)
2. Parameter variables are initialized
3.3 Outcome
1. Evolution operators (recombination and mutation) are perform to generate new individuals for
the next generation
2. Population is updated
3. Communication file _var is created
4. State is set to 3 if complete the above tasks successfully
3.4 Actions
1.
2.
3.
4.
5.
6.
7.
Remove rejected individuals (_arc) from the population
Perform recombination (section Error! Reference source not found.)
Perform mutation (section 5)
Calculate objective vectors for new individuals created in steps 2 and 3
Add new individuals into the population
Create communication file _var
Set status to 3
3.5 Exceptions



Invalid entry in communication files
Rejected individuals to be deleted do not exist in current population
New individuals do not comply to constrains (i.e. negative values). Recombination and mutation
must validate the off-strings to prevent this exception.
4 Recombination
4.1 Trigger
Called by Evolution (section 3)
4.2 Pre-conditions


Parent individuals
Recombination parameters are defined (recombination operator probabilities, cross over rate)
4.3 Outcome

Off-springs from cross over operation
4.4 Actions
1. Form pairs of parent from mating pool (selected by Selector -_sel file)
2. For each pair of parent, select a recombination operator (including null operator) to be
performed using roulette wheel method.
3. Perform SBX recombination on each pair of selected parents. m=pre-defined cross over ratio. At
least 1 decision variable are to be changed.
4. SBX operator on 1 pair of decision variables v1 and v2 generating a new pair of decision variables
v1’ and v2’ is defined as:
5.
6.
7.
8.
o
u=uniformed distributed random variable. 0≤u≤1
o
if u≤0.5, β=2u1/(η+1) , else 𝛽 = (
1−𝑢 1/(𝜂+1)
)
, where
2
η is a configurable parameter.
o v1’ = ½((1+β)v1+(1-β)v2); v2’ = ½((1-β)v1+(1+β)v2)
One-point SBX: Randomly select a point in the decision variable array, perform SBX operator at
the selected point, swap the values of the decision variables from that point to the end of the
array.
Two-point SBX: Randomly select 2 points in the decision variable array, perform SBX operator at
the selected points, swap the values of the decision variables between two points of the array.
Uniform SBX: Randomly select a number of points (the number is based on the recombination
rate) in the decision variable array, perform SBX operator at the selected points.
Validate off-strings (valid range of decision variables). If a variable is out of valid range, assign
the closest valid value to the variable.
4.5 Exceptions
5 Mutation
5.1 Trigger
Called by Evolution (section 3)
5.2 Pre-conditions


Parent individuals
Mutation parameters are defined (mutation operator probability, mutation rate, parameters of
mutation operators)
5.3 Outcome

Off-springs from mutation operation
5.4 Actions
1. Select mutation operation (including null operator) to performed using roulette wheel method.
2. Trigonometric mutation:
o Randomly select 1 parent (r1) and 2 individuals from known population (r2, r3).
o Calculate p1’=max(ε1,2, ε1,3); p2’=max(ε2,1, ε2,3); p3’=max(ε3,1, ε3,2), where ε1,2 is the
smallest real number so that individual1.objective ≤ ε1,2 * individual2.objective for all 3
objectives
o Normalize: p1=p1’/(p1’+p2’+p3’); p2=p2’/(p1’+p2’+p3’); p2=p3’/(p1’+p2’+p3’)
o V=(r1+r2+r3)/3 + (p2-p1) (r1-r2) + (p3-p2) (r2-r3) + (p1-p3) (r3-r1)
o Scan the decision variable array, assign new value from V to the decision variable if a
randomly generated number is less than the predefined mutation rate.
o
Validate off-strings (valid range of decision variables). If a variable is out of valid range,
assign the closest valid value to the variable.
3. Rand/2/dir mutation:
o Randomly select r1, r3 from parents and r2, r4 from known population
o
𝐹
V=r1 + 2 (r1-r2+r3-r4)
o
Scan the decision variable array, assign new value from V to the decision variable if a
randomly generated number is less than the predefined mutation rate.
o Validate off-strings (valid range of decision variables). If a variable is out of valid range,
assign the closest valid value to the variable.
4. Polynomial mutation (POMO)
o Randomly select r1, r2, r3 from parents
o
For each variable i: 𝑐2𝑖 =
6.
7.
8.
2
, 𝑐1𝑖 =
4𝑥𝑖1 −3𝑥𝑖0 −𝑥𝑖2
2
, 𝑐0𝑖 = 𝑥𝑖0
𝑣𝑖 = 𝑐2𝑖 𝑡 2 + 𝑐1𝑖 𝑡 + 𝑐0𝑖 , -1<t<3\
Scan the decision variable array, assign new value from V to the decision variable if a
randomly generated number is less than the predefined mutation rate.
o Validate off-strings (valid range of decision variables). If a variable is out of valid range,
assign the closest valid value to the variable.
Differential Evolution mutation (rand/1/bin)
o Randomly select r1, r2, r3 from parents
o V=r1 + F x (r2-r3), 0<=F<=2
o Scan the decision variable array, assign new value from V to the decision variable if a
randomly generated number is less than the predefined mutation rate.
o Validate off-strings (valid range of decision variables). If a variable is out of valid range,
assign the closest valid value to the variable.
Random Mutation
o Scan the decision variable array, assign a new value X’i = random(xi-step, xi+step) to the
decision variable if a randomly generated number is less than the predefined mutation
rate.
o Validate off-strings (valid range of decision variables). If a variable is out of valid range,
assign the closest valid value to the variable.
Gaussian Mutation
o Scan the decision variable array, assign a new value X’I = xi + nextGaussian()*step to the
decision variable if a randomly generated number is less than the predefined mutation
rate.
Q-Gaussian mutation
o X’I = qGaussian(xi, q, k)
o Validate off-strings (valid range of decision variables). If a variable is out of valid range,
assign the closest valid value to the variable.
o
o
5.
𝑥𝑖0 −2𝑥𝑖1 +𝑥𝑖2
5.5 Exceptions
6 Generated interval report
6.1 Trigger
Called by Evolution (every generation interval).
6.2 Pre-conditions
Evolution is in progress (state 2)
6.3 Outcome
1. Intermediate reports, name by the current generation number (<Generation> and
<generation>.dat)
<Generation> file template:
<Number of individual lines>
<Individual ID> <tab> <Objective values> <tab> <Decision variables>
… (one line for each individual)
END
I1=<Performance Indicator 1><Tab>I2=<Performance Indicator 2><Tab>
I3=<Performance Indicator 3>
2. <Generation>.dat file template:
<Tab separated objective values>
… (one line for each individual)
3. Elapse time is recorded
4. Performance indicators are calculated and recorded
6.4 Actions
1. Recode elapse time
2. Calculate and record intermediate performance metrics.
3. Scan current population and generate interval output files as specified.
6.5 Exceptions
7 Termination
7.1 Trigger
Termination conditions are met.
7.2 Pre-conditions
Evolution is in progress (state 2)
7.3 Outcome
1. Final population file
Output file template:
<Number of individual lines>
<Individual ID> <tab> <Objective values> <tab> <Decision variables>
… (one line for each individual)
END
I1=<Performance Indicator 1><Tab>I2=<Performance Indicator 2><Tab>
I3=<Performance Indicator 3>
2. Plot script (plot.plt)
3. Data file to generate 3D charts (data.dat)
<Tab separated objective values>
… (one line for each individual)
4. Report file in HTML format.
5. Set State=5 (termination)
7.4 Actions
1.
2.
3.
4.
5.
Set state=4 (prepare to terminate).
Remove dominated individuals from the population.
Calculate and record performance metrics
Generate output files
Set state 5 (Terminated).
7.5 Exception
Download