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.
my_fzn_run_stream(ModelStream, Options) :-
fzn_init(Options, State),
fzn_load_stream(ModelStream, State),
fzn_search(State),
fzn_output(State),
fzn_last(State),
!.