Skip to content

Main content

Random Ski Rental Usage Experiment Generator

Generate bounded uniform or censored-geometric usage horizons and delegate online-versus-hindsight ski-rental costs with empirical summaries.

Loading tool…

Description

Generate bounded uniform or censored-geometric usage horizons and delegate online-versus-hindsight ski-rental costs with empirical summaries.

An optimization instance defines choices, constraints, and an objective. A feasible witness demonstrates that its stated constraints can be met; it establishes optimality only when the tool actually computes and verifies an optimum.

Generate bounded uniform or censored-geometric usage horizons and delegate online-versus-hindsight ski-rental costs with empirical summaries.

When to use this tool

Use this generator to create reproducible ski rental usage experiment cases from the supplied model or bank. Inspect the returned evidence before using cases in a test or exercise.

How to use the tool and how it works

  1. Supply count, minimumDays, maximumDays, distribution, stopProbability, rentalCost, purchaseCost in the field shapes below. Set seed when you need an explicit replay.
  2. Run the tool and correct any input error. For generated controls, distinguish a successful fixture containing an invalid case from failure to generate the fixture.
  3. Read trials, meanOnlineCost, meanOptimalCost, worstObservedRatio, convention. Use the conventions below and keep answer-bearing fields separate when presenting an exercise.

Draw usage duration uniformly or as minimumDays plus a geometric failure count censored at maximumDays. Delegate the policy that rents before ceil(purchaseCost/rentalCost) and buys on that day. Aggregate online and optimal costs and observed cost ratios.1

Delegated operations used for this result: ski rental. Their calculation or parsing conventions apply to the corresponding result fields.2

Input fieldMeaning and unitsAccepted input
countRequested count; the mechanics explain whether one draw expands into several returned records.Required. Safe integer; minimum 1; maximum 128.
minimumDaysMinimum DaysRequired. Safe integer; minimum 0.
maximumDaysMaximum DaysRequired. Safe integer; minimum 0.
distributionDistributionRequired. Text; one of "uniform", "censored-geometric".
stopProbabilityStop ProbabilityOptional. Finite number; maximum 1; strictly above 0.
rentalCostRental CostRequired. Finite number; strictly above 0.
purchaseCostPurchase CostRequired. Finite number; strictly above 0.
seedOptional numeric seed; takes precedence over context randomness. Without either, use the fixed tool.io default seed.Optional. Safe integer.
Output fieldInterpretationReturned shape
trialsTrialsRequired. Array of Object; no unknown keys.; minimum items 1; maximum items 128.
trials[].usageDaysUsage DaysRequired. Safe integer; minimum 0.
trials[].resultResultRequired. Object; no unknown keys.
trials[].result.competitiveRatioCompetitive RatioRequired. Finite number.
trials[].result.decisionDecisionRequired. Text.
trials[].result.onlineCostOnline CostRequired. Finite number.
trials[].result.optimalCostOptimal CostRequired. Finite number.
trials[].result.purchaseDayPurchase DayRequired. Safe integer; minimum 1.
trials[].ratioRatioRequired. Finite number.
meanOnlineCostMean Online CostRequired. Finite number.
meanOptimalCostMean Optimal CostRequired. Finite number.
worstObservedRatioWorst Observed RatioRequired. Finite number.
conventionConventionRequired. Text.
randomnessReplay metadata: source is seed or context; seed is the normalized 32-bit seed or null for a context source.Required. Object; no unknown keys.
randomness.seedOptional numeric replay seed; normalization and precedence are explained below.Required. Safe integer. or Null.
randomness.sourceSourceRequired. Text; one of "context", "seed".

An explicit safe-integer seed takes precedence over injected context randomness and is normalized to an unsigned 32-bit integer. With no seed and no context source, replay uses the fixed tool.io default seed. A context source must return finite values from zero inclusive to one exclusive; its advancing state must be retained separately. randomness records the source and normalized seed, or null for context. These generators are not cryptographic random sources.

json
{
  "input": {
    "count": 4,
    "minimumDays": 0,
    "maximumDays": 6,
    "distribution": "uniform",
    "rentalCost": 10,
    "purchaseCost": 40,
    "seed": 42
  },
  "output": {
    "trials": [
      {
        "usageDays": 4,
        "result": {
          "competitiveRatio": 1.75,
          "decision": "buy on day 4",
          "onlineCost": 70,
          "optimalCost": 40,
          "purchaseDay": 4
        },
        "ratio": 1.75
      },
      {
        "usageDays": 3,
        "result": {
          "competitiveRatio": 1,
          "decision": "rent",
          "onlineCost": 30,
          "optimalCost": 30,
          "purchaseDay": 4
        },
        "ratio": 1
      },
      {
        "usageDays": 5,
        "result": {
          "competitiveRatio": 1.75,
          "decision": "buy on day 4",
          "onlineCost": 70,
          "optimalCost": 40,
          "purchaseDay": 4
        },
        "ratio": 1.75
      },
      {
        "usageDays": 4,
        "result": {
          "competitiveRatio": 1.75,
          "decision": "buy on day 4",
          "onlineCost": 70,
          "optimalCost": 40,
          "purchaseDay": 4
        },
        "ratio": 1.75
      }
    ],
    "meanOnlineCost": 60,
    "meanOptimalCost": 37.5,
    "worstObservedRatio": 1.75,
    "convention": "Buy on ceil(purchaseCost/rentalCost), after renting on earlier usage days. Geometric failures are shifted by minimumDays and censored at maximumDays. Core ratios inherit 12-significant-digit rounding; ratio is unrounded. Observed maxima are not global competitive guarantees.",
    "randomness": {
      "seed": 42,
      "source": "seed"
    }
  }
}

Limitations and assumptions

  • Observed worst ratio is not a global competitive guarantee. A zero optimal cost maps to ratio one. Costs use one caller-chosen unit; delegated ratios use rounded core results while the separate ratio is unrounded.
  • A replay requires the same complete input and implementation. Randomized construction does not guarantee uniform coverage of every feasible output; finite samples can repeat unless a distinct-selection rule is explicitly stated.
  • The field tables state structural bounds; cross-field constraints and bounded search or output budgets also apply. Unknown keys are rejected where the object contract disallows them. Input errors are distinct from null fields and deliberate invalid controls in a successful output.

Alternative or Complementary methods

For a supplied example, inspect the returned construction or delegated check directly. To evaluate a consumer, also test cases chosen for its own boundaries; a generated finite corpus does not establish exhaustive coverage.

References

  1. Tool behavior and example: Random Ski Rental Usage Experiment Generator — tool.io

  2. Calculation or validation: online-algorithm/ski-rental — tool.io

Similar or alternative tools

  • Random Interval Scheduling Challenge Generator

    Generate synthetic positive-duration half-open jobs and solve the declared count or weight objective exactly with finish-time dynamic programming, retaining one optimum with exclusion on objective ties.

  • Random Job-Shop Scheduling Instance Generator

    Generate positive integer processing times and a per-job random machine permutation with a feasible job-priority schedule witness; no makespan optimality claim.