ArticleslgStudy

mathematics

SAMPL

SAMPL is a mathematics topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand SAMPL rather than just read about it. In short: SAMPL, which stands for "Stochastic AMPL", is an algebraic modeling language resulting by expanding the well-known language AMPL with extended syntax and keywords. It is designed specifically for representing stochastic programming problems and, through recent extensions, problems with chance constraints, integrated chance constraints and robust optimization problems.

Key takeaways

  • SAMPL belongs to mathematics; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect SAMPL to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of SAMPL from memory before moving on to harder problems.

Reference excerpt

SAMPL, which stands for "Stochastic AMPL", is an algebraic modeling language resulting by expanding the well-known language AMPL with extended syntax and keywords. It is designed specifically for representing stochastic programming problems and, through recent extensions, problems with chance constraints, integrated chance constraints and robust optimization problems. It can generate the deterministic equivalent version of the instances, using all the solvers AMPL connects to, or generate an SMPS representation and use specialized decomposition based solvers, like FortSP.

Language Features SAMPL shares all language features with AMPL, and adds some constructs specifically designed for expressing scenario based stochastic programming and robust optimization.

Stochastic programming features and constructs To express scenario-based SP problems, additional constructs describe the tree structure and group the decision variable into stages. Moreover, it is possible to specify which parameter stores the probabilities for each branch of the tree and which set represents the scenario set. Other constructs to easily define chance constraints and integrated chance constraint in an SP problem are available as well. Using these language constructs allows to retain the structure of the problem, hence making it available to the solvers, which might exploit it using specialized decomposition methods like Benders' decomposition to speed-up the solution.

Robust optimization constructs SAMPL supports constructs to describe three types of robust optimization formulations:

Soyster Bertsimas and Sim Ben-Tal and Nemirovski

Availability SAMPL is currently available as a part of the software AMPLDev (distributed by www.optirisk-systems.com). It supports many popular 32- and 64-bit platforms including Windows, Linux and Mac OS X. A free evaluation version with limited functionality is available.

A stochastic programming sample model The following is the SAMPL version of a simple problem (Dakota), to show the SP related constructs. It does not include the data file, which follows the normal AMPL syntax (see the example provided in the AMPL Wikipedia page for further reference).

set Prod; set Resource;

# Scenarios (future possible realizations) scenarioset Scen;

# Definition of the problem as a two-stage problem tree Tree := twostage;

# Demand for each product in each scenario random param Demand{Prod, Scen};

# Probability of each scenario probability P{Scen};

# Cost of each unit of resource param Cost{Resource};

# Requirement in terms of resources units to produce one unit of each product param ProdReq{Resource,Prod};

# Selling price of each product param Price{Prod};

# Initial budget param Budget;

# Amount of resources to buy var buy{r in Resource} >= 0, suffix stage 1;

# Amount of each product to produce var amountprod{p in Prod, s in Scen} >= 0, suffix stage 2;

# Amount of each product to sell var amountsell{p in Prod, s in Scen} >= 0, suffix stage 2;

# Total final wealth, as expected total income from sales minus costs for the resources maximize wealth: sum{s in Scen} P[s] * (sum{p in Prod} Price[p] * amountsell[p,s] - sum{r in Resource} Cost[r] * buy[r]);

subject to # Make sure you have enough resources to produce what we intend to balance{r in Resource, s in Scen}: buy[r] >= sum{p in Prod} ProdReq[r,p] * amountprod[p, s]; # Make sure we do not sell what we did not produce production{p in Prod, s in Scen}: amountsell[p,s] <= amountprod[p,s]; # Make sure we do not sell more than the market demand sales{p in Prod, s in Scen}: amountsell[p,s] <= Demand[p,s]; # Respect initial budget budgetres: sum{r in Resource} Cost[r] * buy[r] <= Budget;

Solvers connectivity SAMPL instance level format for SP problems is SMPS, and therefore the problem can be solved by any solver which supports that standard. One of such solvers (FortSP) is included in the standard SAMPL distribution. Regarding robust optimization problems, the needed solver depend on the specific formulation used, as Ben-Tal and Nemirovski formulation need a second-order cone capable solver.

See also Algebraic modeling language AIMMS AMPL FortSP GAMS – General Algebraic Modeling System GLPK – free open source system based on a subset of AMPL HiGHS - HiGHS is high performance serial and parallel software for solving large-scale sparse linear programming (LP), mixed-integer programming (MIP) and quadratic programming (QP) models MPS (format) Robust optimization Stochastic programming

References

External links AMPL home page OptiRisk Systems home page HiGHS solver home page

Worked examples

Example 1 — a first encounter with SAMPL

Start with the simplest possible case. Write down what SAMPL claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In mathematics, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to SAMPL before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about SAMPL ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of SAMPL

In research
SAMPL appears in mathematics research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses SAMPL in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
SAMPL is common in secondary-school and first-year university syllabi. It links to neighbouring topics 1990 software, Computer algebra systems, Mathematical modeling, so understanding it makes those chapters shorter.
In everyday life
Look for SAMPL outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study SAMPL in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what SAMPL means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain SAMPL out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is SAMPL in simple terms?

SAMPL, which stands for "Stochastic AMPL", is an algebraic modeling language resulting by expanding the well-known language AMPL with extended syntax and keywords. It is designed specifically for representing stochastic programming problems and, through recent extensions, problems with chance const…

Why does SAMPL matter?

Because it connects several mathematics ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study SAMPL?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on SAMPL.

Tags

  • 1990 software
  • Computer algebra systems
  • Mathematical modeling
  • Mathematical optimization software
  • Numerical programming languages
  • Text-oriented programming languages

Keep exploring