3import umontreal.ssj.rng.*;
4import umontreal.ssj.randvar.*;
5import umontreal.ssj.probdist.PoissonDist;
6import umontreal.ssj.stat.Tally;
7import umontreal.ssj.util.*;
9public class Inventory {
21 Tally statProfit =
new Tally(
"stats on profit");
23 public Inventory(
double lambda,
double c,
double h,
double K,
double k,
double p) {
35 public double simulate(
int m,
int s,
int S) {
39 for (
int j = 0; j < m; j++) {
40 Yj = Xj - genDemand.nextInt();
43 profit += c * (Xj - Yj) - h * Yj;
44 if ((Yj < s) && (streamOrder.nextDouble() < p)) {
46 profit -= K + k * (S - Yj);
57 public void simulateRuns(
int n,
int m,
int s,
int S) {
58 for (
int i = 0; i < n; i++)
59 statProfit.add(simulate(m, s, S));
62 public static void main(String[] args) {
63 Inventory system =
new Inventory(100.0, 2.0, 0.1, 10.0, 1.0, 0.95);
65 system.simulateRuns(500, 2000, 80, 200);
67 System.out.println(system.statProfit.
report(0.9, 3));
68 System.out.println(
"Total CPU time: " + timer.
format() +
"\n");
Extends the class DiscreteDistributionInt for the Poisson distribution slaw00a (page 325) with mean.
This class implements random variate generators having the Poisson distribution.
This is the base class for all generators of discrete random variates over the set of integers.
Extends the abstract class RandomStreamBase by using as a backbone (or main) generator the combined m...
void setConfidenceIntervalStudent()
Indicates that a confidence interval on the true mean, based on the normality assumption,...
String report()
Returns a formatted string that contains a report on this probe.
String format()
Converts the CPU time used by the program since its last call to init for this AbstractChrono to a St...
The Chrono class extends the umontreal.ssj.util.AbstractChrono class and computes the CPU time for th...
This interface defines the basic structures to handle multiple streams of uniform (pseudo)random numb...