Solver NOTES

From ASCEND
Jump to: navigation, search

Using solver NOTES is no longer the preferred approach to solving this problem. We now suggest you use the OPTION command, even though it is still somewhat experimental.

Solver NOTES are a special kind of NOTES in ASCEND that allow you to specify parameters for use in the solver when running a particular model. This uses the ExtPy mechanism, which isn't yet considered stable.

To use solver notes, try

IMPORT "johnpye/solvernotes";

ADD NOTES IN mymodel;
    'solver' name {QRSlv}
    'QRSlv' iterationlimit {50}

    'QRSlv' singtol {1e-10}
END NOTES;

MODEL mymodel;

    x, y IS_A solver_var;
    x = y^2;

METHODS
    METHOD on_load;
        EXTERNAL solvernotes(SELF);
    END on_load;

END mymodel;

The above specifies that the preferred solver for the model mymodel is QRSlv, then sets the iterationlimit and singtol parameters when using that solver. The external method, solvernotes must be IMPORTed, and called using the EXTERNAL statement.