# FAQs

**URL:** https://discuss.ampl.com/c/faq/5.md

[Latest](https://discuss.ampl.com/latest.md) · [Categories](https://discuss.ampl.com/categories.md) · [Tags](https://discuss.ampl.com/tags.md)

---

## [AMPL Frequently Asked Questions](https://discuss.ampl.com/t/ampl-frequently-asked-questions/30)

<div class="topic-metadata">

**Author:** [@martin](https://discuss.ampl.com/u/martin)\
**Replies:** 0\
**Last updated:** [December 13, 2021, 8:26pm UTC](https://discuss.ampl.com/t/ampl-frequently-asked-questions/30 "2021-12-13T20:26:23Z")

</div>

Select a category from the Tags menu to see all FAQs relevant to a particular topic.

---

## [How can I optimize more than one objective function?](https://discuss.ampl.com/t/how-can-i-optimize-more-than-one-objective-function/1135)

<div class="topic-metadata">

**Author:** [@4er](https://discuss.ampl.com/u/4er)\
**Replies:** 0\
**Last updated:** [June 28, 2024, 5:24pm UTC](https://discuss.ampl.com/t/how-can-i-optimize-more-than-one-objective-function/1135 "2024-06-28T17:24:29Z")

</div>

You can define any number of objective functions in an AMPL model. However, solvers only minimize or maximize one objective at a time. If your model has, say, three minimize statements that define objectives A, B, and C,…

---

## [How do I specify options for a solver?](https://discuss.ampl.com/t/how-do-i-specify-options-for-a-solver/1136)

<div class="topic-metadata">

**Author:** [@4er](https://discuss.ampl.com/u/4er)\
**Replies:** 0\
**Last updated:** [June 28, 2024, 10:11pm UTC](https://discuss.ampl.com/t/how-do-i-specify-options-for-a-solver/1136 "2024-06-28T22:11:41Z")

</div>

You can specify option settings for a particular solver through the AMPL option command. Since all solvers provide default settings for their options, this is necessary only when your problem requires certain nondefault …

---

## [How do I relax the integrality of only some of a model’s integer variables?](https://discuss.ampl.com/t/how-do-i-relax-the-integrality-of-only-some-of-a-model-s-integer-variables/48)

<div class="topic-metadata">

**Author:** [@megrobert](https://discuss.ampl.com/u/megrobert)\
**Replies:** 0\
**Last updated:** [December 15, 2021, 5:23pm UTC](https://discuss.ampl.com/t/how-do-i-relax-the-integrality-of-only-some-of-a-model-s-integer-variables/48 "2021-12-15T17:23:51Z")

</div>

For each variable whose integrality you want to relax, assign a positive value to variable-name.relax . For example, if your model has var X {1..n} integer \>= 0; var Y {1..m} integer \>= 0; then to relax the integralit…

---

## [Why do I get an “invalid subscript discarded” message when I display an AMPL parameter?](https://discuss.ampl.com/t/why-do-i-get-an-invalid-subscript-discarded-message-when-i-display-an-ampl-parameter/59)

<div class="topic-metadata">

**Author:** [@megrobert](https://discuss.ampl.com/u/megrobert)\
**Replies:** 0\
**Last updated:** [December 15, 2021, 5:38pm UTC](https://discuss.ampl.com/t/why-do-i-get-an-invalid-subscript-discarded-message-when-i-display-an-ampl-parameter/59 "2021-12-15T17:38:35Z")

</div>

Either a data table gave values for the parameter with incorrect subscripts, or the parameter’s indexing set changed, causing some previously valid subscripts to become invalid. For example, in the diet.mod + diet.dat ex…

---

## [Can I get a version of AMPL that will run on my computer, under my computer’s operating system?](https://discuss.ampl.com/t/can-i-get-a-version-of-ampl-that-will-run-on-my-computer-under-my-computer-s-operating-system/41)

<div class="topic-metadata">

**Author:** [@megrobert](https://discuss.ampl.com/u/megrobert)\
**Replies:** 0\
**Last updated:** [December 15, 2021, 5:08pm UTC](https://discuss.ampl.com/t/can-i-get-a-version-of-ampl-that-will-run-on-my-computer-under-my-computer-s-operating-system/41 "2021-12-15T17:08:21Z")

</div>

AMPL is available on all of the most popular platforms, including all recent versions of Windows, Linux, and MacOS, as well as several Unix systems. Solver availability varies, but generally also covers the popular platf…

---

## [What is AMPL (A Mathematical Programming Language)?](https://discuss.ampl.com/t/what-is-ampl-a-mathematical-programming-language/83)

<div class="topic-metadata">

**Author:** [@megrobert](https://discuss.ampl.com/u/megrobert)\
**Replies:** 0\
**Last updated:** [December 15, 2021, 6:09pm UTC](https://discuss.ampl.com/t/what-is-ampl-a-mathematical-programming-language/83 "2021-12-15T18:09:25Z")

</div>

AMPL is a computer language for describing production, distribution, blending, scheduling and many other kinds of problems known generally as large-scale optimization or mathematical programming. AMPL’s familiar algebra…

---

## [How does AMPL compare to spreadsheet optimizers?](https://discuss.ampl.com/t/how-does-ampl-compare-to-spreadsheet-optimizers/82)

<div class="topic-metadata">

**Author:** [@megrobert](https://discuss.ampl.com/u/megrobert)\
**Replies:** 0\
**Last updated:** [December 15, 2021, 6:08pm UTC](https://discuss.ampl.com/t/how-does-ampl-compare-to-spreadsheet-optimizers/82 "2021-12-15T18:08:56Z")

</div>

The Excel spreadsheet package comes with solvers for linear, nonlinear, and integer programming; it accepts enhanced add-in solvers as well. Their principal advantage lies in allowing all aspects of optimization — includ…

---

## [How does AMPL compare to other modeling languages and systems?](https://discuss.ampl.com/t/how-does-ampl-compare-to-other-modeling-languages-and-systems/81)

<div class="topic-metadata">

**Author:** [@megrobert](https://discuss.ampl.com/u/megrobert)\
**Replies:** 0\
**Last updated:** [December 15, 2021, 6:08pm UTC](https://discuss.ampl.com/t/how-does-ampl-compare-to-other-modeling-languages-and-systems/81 "2021-12-15T18:08:32Z")

</div>

AMPL is one of several optimization modeling systems that are designed around specialized algebraic modeling languages. These languages employ adaptations of familiar mathematical notation to describe optimization proble…

---

## [How can I learn more about AMPL?](https://discuss.ampl.com/t/how-can-i-learn-more-about-ampl/80)

<div class="topic-metadata">

**Author:** [@megrobert](https://discuss.ampl.com/u/megrobert)\
**Replies:** 0\
**Last updated:** [December 15, 2021, 6:07pm UTC](https://discuss.ampl.com/t/how-can-i-learn-more-about-ampl/80 "2021-12-15T18:07:57Z")

</div>

The AMPL book is the most comprehensive source of information on AMPL. It is written in the form of a textbook with an appendix for reference, in contrast to the more common format of a reference manual with some tutoria…

---

## [How big a problem can AMPL solve?](https://discuss.ampl.com/t/how-big-a-problem-can-ampl-solve/79)

<div class="topic-metadata">

**Author:** [@megrobert](https://discuss.ampl.com/u/megrobert)\
**Replies:** 0\
**Last updated:** [December 15, 2021, 6:07pm UTC](https://discuss.ampl.com/t/how-big-a-problem-can-ampl-solve/79 "2021-12-15T18:07:35Z")

</div>

The free “student” version of AMPL is limited to 300 variables (500 for linear problems) and a total of 300 objectives and constraints. However all other AMPL versions have no intrinsic limit on problem size; they are li…

---

## [Can my program call AMPL as a subroutine?](https://discuss.ampl.com/t/can-my-program-call-ampl-as-a-subroutine/78)

<div class="topic-metadata">

**Author:** [@megrobert](https://discuss.ampl.com/u/megrobert)\
**Replies:** 0\
**Last updated:** [December 15, 2021, 6:07pm UTC](https://discuss.ampl.com/t/can-my-program-call-ampl-as-a-subroutine/78 "2021-12-15T18:07:15Z")

</div>

Currently AMPL is not configured as a subroutine library whose individual pieces can be called as needed from a user’s program. A “batch” session of AMPL can be executed from a program in any popular programming language…

---

## [How can I edit my model or data file without leaving the AMPL command environment?](https://discuss.ampl.com/t/how-can-i-edit-my-model-or-data-file-without-leaving-the-ampl-command-environment/77)

<div class="topic-metadata">

**Author:** [@megrobert](https://discuss.ampl.com/u/megrobert)\
**Replies:** 0\
**Last updated:** [December 15, 2021, 6:06pm UTC](https://discuss.ampl.com/t/how-can-i-edit-my-model-or-data-file-without-leaving-the-ampl-command-environment/77 "2021-12-15T18:06:17Z")

</div>

Use AMPL’s shell command to invoke the editor you want to use. For example, if your editor is called edit and your file is diet2a.dat , give the command shell "edit diet2a.dat"; The editor temporarily pops up (or takes…

---

## [How do I solve a series of different random problems with data drawn from the same distribution?](https://discuss.ampl.com/t/how-do-i-solve-a-series-of-different-random-problems-with-data-drawn-from-the-same-distribution/76)

<div class="topic-metadata">

**Author:** [@megrobert](https://discuss.ampl.com/u/megrobert)\
**Replies:** 0\
**Last updated:** [December 15, 2021, 6:05pm UTC](https://discuss.ampl.com/t/how-do-i-solve-a-series-of-different-random-problems-with-data-drawn-from-the-same-distribution/76 "2021-12-15T18:05:12Z")

</div>

Use AMPL’s reset data command to resample from all of the random-valued functions in the model. For example, in model steel4.mod from the AMPL book, suppose that parameter avail is changed so that its value is given by a…

---

## [When does AMPL evaluate the conditions specified in my model’s check statements?](https://discuss.ampl.com/t/when-does-ampl-evaluate-the-conditions-specified-in-my-model-s-check-statements/75)

<div class="topic-metadata">

**Author:** [@megrobert](https://discuss.ampl.com/u/megrobert)\
**Replies:** 0\
**Last updated:** [December 15, 2021, 6:01pm UTC](https://discuss.ampl.com/t/when-does-ampl-evaluate-the-conditions-specified-in-my-model-s-check-statements/75 "2021-12-15T18:01:15Z")

</div>

The check conditions are evaluated each time that AMPL generates (or re-generates) an instance of your model. Normally the generation of an instance is triggered by a solve command, but a few other commands such as write …

---

## [How do I write an “MPS file” for my problem?](https://discuss.ampl.com/t/how-do-i-write-an-mps-file-for-my-problem/74)

<div class="topic-metadata">

**Author:** [@megrobert](https://discuss.ampl.com/u/megrobert)\
**Replies:** 0\
**Last updated:** [December 15, 2021, 6:00pm UTC](https://discuss.ampl.com/t/how-do-i-write-an-mps-file-for-my-problem/74 "2021-12-15T18:00:44Z")

</div>

You can use AMPL’s write command to create a file that contains a representation of your linear or integer program in a standard format known as MPS form. To write an MPS-form file for the diet LP from Chapter 2 of the A…

---

## [Why does AMPL write an MPS file that is different from what I expect?](https://discuss.ampl.com/t/why-does-ampl-write-an-mps-file-that-is-different-from-what-i-expect/73)

<div class="topic-metadata">

**Author:** [@megrobert](https://discuss.ampl.com/u/megrobert)\
**Replies:** 0\
**Last updated:** [December 15, 2021, 5:59pm UTC](https://discuss.ampl.com/t/why-does-ampl-write-an-mps-file-that-is-different-from-what-i-expect/73 "2021-12-15T17:59:18Z")

</div>

Several kinds of transformations may be applied by AMPL before it writes out any representation of your problem. Normally you need not be aware of these changes, because AMPL reverses them after receiving the optimal sol…

---

## [What are the transformations that AMPL applies to optimization problems?](https://discuss.ampl.com/t/what-are-the-transformations-that-ampl-applies-to-optimization-problems/72)

<div class="topic-metadata">

**Author:** [@megrobert](https://discuss.ampl.com/u/megrobert)\
**Replies:** 0\
**Last updated:** [December 15, 2021, 5:58pm UTC](https://discuss.ampl.com/t/what-are-the-transformations-that-ampl-applies-to-optimization-problems/72 "2021-12-15T17:58:33Z")

</div>

AMPL’s presolve phase attempts to transform your problem to an equivalent one that is smaller and easier to solve. Presolve first removes trivial model components, such as variables fixed at constant values and constrain…

---

## [How can I prevent AMPL from transforming my problem?](https://discuss.ampl.com/t/how-can-i-prevent-ampl-from-transforming-my-problem/71)

<div class="topic-metadata">

**Author:** [@megrobert](https://discuss.ampl.com/u/megrobert)\
**Replies:** 0\
**Last updated:** [December 15, 2021, 5:57pm UTC](https://discuss.ampl.com/t/how-can-i-prevent-ampl-from-transforming-my-problem/71 "2021-12-15T17:57:46Z")

</div>

To suppress the presolve phase, set option presolve 0 . To suppress transformation of piecewise-linear terms, set option pl\_linearize 0 . To suppress elimination of variables by substitution from constraints, set optio…

---

## [Why does AMPL reject my “let” statement with a “… has a := value in the model” message?](https://discuss.ampl.com/t/why-does-ampl-reject-my-let-statement-with-a-has-a-value-in-the-model-message/70)

<div class="topic-metadata">

**Author:** [@megrobert](https://discuss.ampl.com/u/megrobert)\
**Replies:** 0\
**Last updated:** [December 15, 2021, 5:56pm UTC](https://discuss.ampl.com/t/why-does-ampl-reject-my-let-statement-with-a-has-a-value-in-the-model-message/70 "2021-12-15T17:56:54Z")

</div>

Your let command is attempting to assign a value to some set or parameter. In the set’s or parameter’s declaration, however, you have used a := phrase to permanently define the value. A let command is not permitted to re…

---

## [What does AMPL mean by “syntax error”? I double-checked the offending statement in the AMPL book, and my syntax is fine](https://discuss.ampl.com/t/what-does-ampl-mean-by-syntax-error-i-double-checked-the-offending-statement-in-the-ampl-book-and-my-syntax-is-fine/69)

<div class="topic-metadata">

**Author:** [@megrobert](https://discuss.ampl.com/u/megrobert)\
**Replies:** 0\
**Last updated:** [December 15, 2021, 5:56pm UTC](https://discuss.ampl.com/t/what-does-ampl-mean-by-syntax-error-i-double-checked-the-offending-statement-in-the-ampl-book-and-my-syntax-is-fine/69 "2021-12-15T17:56:17Z")

</div>

AMPL is signaling an invalid statement of some sort, but the error may not be a matter of “syntax” in the usual sense. For example, you could be trying to define a set index at a place where it is already in use: ampl: …

---

## [How can I tell whether messages on my screen are coming from AMPL or from the solver?](https://discuss.ampl.com/t/how-can-i-tell-whether-messages-on-my-screen-are-coming-from-ampl-or-from-the-solver/68)

<div class="topic-metadata">

**Author:** [@megrobert](https://discuss.ampl.com/u/megrobert)\
**Replies:** 0\
**Last updated:** [December 15, 2021, 5:55pm UTC](https://discuss.ampl.com/t/how-can-i-tell-whether-messages-on-my-screen-are-coming-from-ampl-or-from-the-solver/68 "2021-12-15T17:55:25Z")

</div>

When a solver starts up, it displays a brief identification string such as MINOS 5.5 or CPLEX 12.4 . Output that occurs before this string can be assumed to come from AMPL, while output after is the solver’s. When a sol…

---

## [Why does AMPL appear to “hang” for a long time without accepting any input or producing any output?](https://discuss.ampl.com/t/why-does-ampl-appear-to-hang-for-a-long-time-without-accepting-any-input-or-producing-any-output/67)

<div class="topic-metadata">

**Author:** [@megrobert](https://discuss.ampl.com/u/megrobert)\
**Replies:** 0\
**Last updated:** [December 15, 2021, 5:54pm UTC](https://discuss.ampl.com/t/why-does-ampl-appear-to-hang-for-a-long-time-without-accepting-any-input-or-producing-any-output/67 "2021-12-15T17:54:28Z")

</div>

If AMPL appears to hang after a solve command but before any output from a solver, then it may be taking much more time to generate your problem than you expected. Try setting option times 1, gentimes 1 to get more outpu…

---

## [Why does AMPL unexpectedly abort in the middle of doing something? I get a short error message, but I can’t find it explained in the AMPL book or in the solver documentation](https://discuss.ampl.com/t/why-does-ampl-unexpectedly-abort-in-the-middle-of-doing-something-i-get-a-short-error-message-but-i-can-t-find-it-explained-in-the-ampl-book-or-in-the-solver-documentation/66)

<div class="topic-metadata">

**Author:** [@megrobert](https://discuss.ampl.com/u/megrobert)\
**Replies:** 0\
**Last updated:** [December 15, 2021, 5:53pm UTC](https://discuss.ampl.com/t/why-does-ampl-unexpectedly-abort-in-the-middle-of-doing-something-i-get-a-short-error-message-but-i-can-t-find-it-explained-in-the-ampl-book-or-in-the-solver-documentation/66 "2021-12-15T17:53:53Z")

</div>

You have encountered a low-level error message generated by the operating system. AMPL and the solvers try to trap these messages so as to provide you with more useful information instead; but occasionally a mysterious m…

---

## [What should I do if I suspect that there is insufficient memory for my AMPL session?](https://discuss.ampl.com/t/what-should-i-do-if-i-suspect-that-there-is-insufficient-memory-for-my-ampl-session/65)

<div class="topic-metadata">

**Author:** [@megrobert](https://discuss.ampl.com/u/megrobert)\
**Replies:** 0\
**Last updated:** [December 15, 2021, 5:52pm UTC](https://discuss.ampl.com/t/what-should-i-do-if-i-suspect-that-there-is-insufficient-memory-for-my-ampl-session/65 "2021-12-15T17:52:25Z")

</div>

If AMPL fails before passing control to the solver, your computer may not have enough memory to hold all of the variables, constraints and objectives generated by the AMPL translator. If a failure occurs after the solver…

---

## [Why doesn’t AMPL interpret the expression T..1 as I expect?](https://discuss.ampl.com/t/why-doesn-t-ampl-interpret-the-expression-t-1-as-i-expect/64)

<div class="topic-metadata">

**Author:** [@megrobert](https://discuss.ampl.com/u/megrobert)\
**Replies:** 0\
**Last updated:** [December 15, 2021, 5:46pm UTC](https://discuss.ampl.com/t/why-doesn-t-ampl-interpret-the-expression-t-1-as-i-expect/64 "2021-12-15T17:46:12Z")

</div>

In general, AMPL interprets a..b as {a, a+1, a+2, ..., b-1, b} . Thus when T is greater than one, T..1 is an empty set. To specify the ordered set that goes from T down to 1 , write T..1 by -1 .

---

## [Why does “set S := 50 .. 70” give me a set of only 3 members?](https://discuss.ampl.com/t/why-does-set-s-50-70-give-me-a-set-of-only-3-members/63)

<div class="topic-metadata">

**Author:** [@megrobert](https://discuss.ampl.com/u/megrobert)\
**Replies:** 0\
**Last updated:** [December 15, 2021, 5:45pm UTC](https://discuss.ampl.com/t/why-does-set-s-50-70-give-me-a-set-of-only-3-members/63 "2021-12-15T17:45:39Z")

</div>

You have declared set S in your model and set S := 50 .. 70 in your data. Set expressions are not recognized in AMPL’s data mode, however. Instead AMPL tries to recognize 50 .. 70 as a space-delimited list of members of S…

---

## [I have declared “set S” and “param b {S}”. How do I write an AMPL expression for the arg min of b\[i\] — that is, the s in S such that b\[s\] equals the minimum of b\[i\] over al](https://discuss.ampl.com/t/i-have-declared-set-s-and-param-b-s-how-do-i-write-an-ampl-expression-for-the-arg-min-of-b-i-that-is-the-s-in-s-such-that-b-s-equals-the-minimum-of-b-i-over-al/62)

<div class="topic-metadata">

**Author:** [@megrobert](https://discuss.ampl.com/u/megrobert)\
**Replies:** 0\
**Last updated:** [December 15, 2021, 5:44pm UTC](https://discuss.ampl.com/t/i-have-declared-set-s-and-param-b-s-how-do-i-write-an-ampl-expression-for-the-arg-min-of-b-i-that-is-the-s-in-s-such-that-b-s-equals-the-minimum-of-b-i-over-al/62 "2021-12-15T17:44:12Z")

</div>

There’s no specific arg min operator in AMPL. However, proceeding directly from the definition, you can define the arg min explicitly by a set expression like {s in S: b\[s\] = min {i in S} b\[i\]} This expression gives a …

---

## [How can I get AMPL to index over the “power set” consisting of all subsets of a set?](https://discuss.ampl.com/t/how-can-i-get-ampl-to-index-over-the-power-set-consisting-of-all-subsets-of-a-set/61)

<div class="topic-metadata">

**Author:** [@megrobert](https://discuss.ampl.com/u/megrobert)\
**Replies:** 0\
**Last updated:** [December 15, 2021, 5:42pm UTC](https://discuss.ampl.com/t/how-can-i-get-ampl-to-index-over-the-power-set-consisting-of-all-subsets-of-a-set/61 "2021-12-15T17:42:17Z")

</div>

AMPL can index model components by objects (numbers and character strings) but not by sets of objects. Hence you can’t model a power set directly. You may be able to get the same effect, however, by constructing a number…

---

## [How can I apply AMPL’s ordered-set functions to pairs and higher-dimensional objects?](https://discuss.ampl.com/t/how-can-i-apply-ampl-s-ordered-set-functions-to-pairs-and-higher-dimensional-objects/60)

<div class="topic-metadata">

**Author:** [@megrobert](https://discuss.ampl.com/u/megrobert)\
**Replies:** 0\
**Last updated:** [December 15, 2021, 5:40pm UTC](https://discuss.ampl.com/t/how-can-i-apply-ampl-s-ordered-set-functions-to-pairs-and-higher-dimensional-objects/60 "2021-12-15T17:40:19Z")

</div>

AMPL does not define any ordering on pairs, triples, or objects of higher dimension. Thus next , prev , and other functions that apply to objects in ordered sets cannot be applied to pairs, triples, or tuples of higher d…

[Next page](https://discuss.ampl.com/c/faq/5.md?page=1)
