fix and unfix

362 views
Skip to first unread message

stockage...@gmail.com

unread,
Nov 23, 2021, 3:11:27 AM11/23/21
to AMPL Modeling Language
hi

could you please give us examples about fix unfix, what is the role of these two keywords ? 

i didn't understand the explanation in the book 

stockage...@gmail.com

unread,
Nov 23, 2021, 3:26:57 AM11/23/21
to AMPL Modeling Language
if I fix a variable like this  in the model:  fix varname;   

without precising the value in the model, which value will take ?

AMPL Google Group

unread,
Nov 23, 2021, 1:35:20 PM11/23/21
to AMPL Modeling Language
The "fix" command fixes variables at specified values. You can think of fixing a variable at a value as being equivalent to adding a constraint that the variable must equal the value. The unfix command reverses the effect of fix, so that the variable is not fixed anymore.

A command of the form "fix varname;" fixes the named variable at its current value:
  • Before any solve, the current value is usually the initial value specified in a var statement, or it is 0 if no initial value has been specified.
  • After a solve, the current value is normally the variable's value in the solution returned by the solver.
A variable's current value can also be modified using a data or let statement. If you not sure about a variable's current value, you can use a "display varname;" statement to show it.

A command of the form "fix varname := expression;" fixes the variable at the value given by the expression.


--
Robert Fourer
am...@googlegroups.com
{#HS:1705109371-107303#}
On Tue, Nov 23, 2021 at 8:27 AM UTC, AMPL Modeling Language <am...@googlegroups.com> wrote:
if I fix a variable like this in the model: fix varname;

without precising the value in the model, which value will take ?

Reply all
Reply to author
Forward
0 new messages