[ library(flatzinc) | Reference Manual | Alphabetic Index ]

# fzn_last(+FznState)

Increments solutions count, and succeeds if last one reached

FznState
  a FlatZinc state descriptor

## Description

Assuming a model has previously been loaded successfully using fzn_load_xxx or mzn_load_xxx, this primitive can be used to limit the number of solutions produced. It increments a nonlogical counter and fails as long as the number of solutions that were requested in the zn_options has not yet been reached.

### Modes and Determinism

- fzn_last(+) is semidet

### Fail Conditions

Fails if not enough solutions found yet

## Examples

        my_fzn_run_stream(ModelStream, Options) :-
    	fzn_init(Options, State),
    	fzn_load_stream(ModelStream, State),
    	fzn_search(State),
    	fzn_output(State),
    	fzn_last(State),
    	!.

## See Also

struct(zn_options), fzn_init / 2, fzn_search / 1