FIX

From ASCEND

Jump to: navigation, search

The FIX statement is used in METHODS to specify when a variable will have a certain fixed value in the case being solved. The opposite of the FIX action is FREE.

MODEL parabola;
    x, y IS_A solver_var;
    y = x^2 + 4*x + 4;
METHODS
METHOD on_load;
    FIX x; (* fix this variable *)
    x := -1; (* assign the value for 'x' *)
    FREE y; (* free this variable (not actually necessary *)
END on_load;
END parabola;

In the above example, the variable 'x' is being FIXed and assigned a value of -1, so we are going to solve for 'y' (which actually will be achieved by QRSlv's direct solve capability, with no need for iteration in this case).

Note that variables are FREE by default, so the FREE y line is not really necessary.

[edit] Alternative syntax

The FIX keyword is shorthand for the older notation:

x.fixed :== TRUE;

[edit] Multiple variables

FIX can be used with multiple variables at once:

x, y, z IS_A solver_var;
(* ...skip to the METHODS section... *)
FIX x, y;
Personal tools