[ library(minizinc) | Third Party Libraries | Reference Manual | Alphabetic Index ]

# mzn_load(++ModelFile, ++SolverOrOptions, ++ParMap, +VarMap, -FznState)

Load a MiniZinc model from a file

ModelFile
  File name (extension defaults to .mzn)
SolverOrOptions
  Name of solver mapping module, or zn_options-structure
ParMap
  List of FznId=ECLiPSeGroundTerm correspondences
VarMap
  List of FznId=ECLiPSeVarTerm correspondences
FznState
  FlatZinc state descriptor

## Description

Loads a MiniZinc from ModelFile. The problem is set up using a mapping to a concrete ECLiPSe solver, as specified in the SolverOrOptions argument. Neither search nor output are done.

To pass parameters into the model, a ParMap can be given, consisting of a list of FznId=ECLiPSeGroundTerm correspondences. Here, FznId is an atom (the FlatZinc parameter identifier within the model), and ECLiPSeGroundTerm is the corresponding ECLiPSe constant.

To access the ECLiPSe variables corresponding to the model's variables, VarMap can be given, consisting of a list of FznId=ECLiPSeTerm correspondences. Here, FznId is an atom (the FlatZinc variable identifier within the model), and ECLiPSeTerm is the corresponding ECLiPSe constant, variable or array.

The mzn_load/5 predicate returns a FlatZinc solver state which can be used to lookup further information about the model (fzn_var_lookup/3, fzn_obj_lookup/2), to perform the standard search (fzn_search/1), or to perform the model's output actions (fzn_output/1).

### Modes and Determinism

- mzn_load(++, ++, ++, +, -) is semidet

### Fail Conditions

Fails if the constraint setup fails

## Examples

        ?- mzn_load("queens", fzn_ic, [n=8], [q=Q], FznState).

        Q = [](_2492{1..8}, _2512{1..8}, _2532{1..8}, _2552{1..8}, ...]
        FznState = state(...)
        There are 84 delayed goals.
        Yes (0.02s cpu)

        ?- mzn_load("queens", fzn_ic, [n=8], [q=Q], FznState),
           ic:labeling(Q).

        Q = [](1, 5, 8, 6, 3, 7, 2, 4)
        FznState = state(...)
        Yes (0.03s cpu, solution 1, maybe more)

        ?- mzn_load("queens", fzn_ic, [n=8], [q=Q], FznState),
           ic:labeling(Q),
           fzn_output(FznState).

        % output from fzn_output:
        q = [1,5,8,6,3,7,2,4]
        Total time 0.030s cpu (0.020 setup)

        % output from ECLiPSe toplevel:
        Q = [](1, 5, 8, 6, 3, 7, 2, 4)
        FznState = state(...)
        Yes (0.03s cpu, solution 1, maybe more)
    </PRE>

## See Also

mzn_run / 2, mzn_run / 3, mzn_load_string / 5, flatzinc : struct(zn_options)