solverl v0.1.3 Minizinc
Minizinc solver API.
Link to this section Summary
Functions
Default Minizinc executable.
Get list of solver ids for solvers available to Minizinc.
Get list of descriptions for solvers available to Minizinc.
Lookup a solver by (possibly partial) id; for results, it could be 'cplex' or 'org.minizinc.mip.cplex'
Shortcut for solve/2.
Solve (asynchronously) with model, data and options.
Shortcut for solve_sync/2.
Solve (synchronously) with model, data and options.
Stop solver process.
Link to this section Types
solver_opt()
Specs
solver_opts()
Specs
solver_opts() :: [solver_opt()]
Link to this section Functions
get_executable()
Default Minizinc executable.
get_solverids()
Get list of solver ids for solvers available to Minizinc.
get_solvers()
Get list of descriptions for solvers available to Minizinc.
lookup(solver_id)
Lookup a solver by (possibly partial) id; for results, it could be 'cplex' or 'org.minizinc.mip.cplex'
solve(model)
Shortcut for solve/2.
solve(model, data, opts \\ [])
Specs
solve(MinizincModel.mzn_model(), MinizincData.mzn_data(), solver_opts()) :: {:ok, pid()}
Solve (asynchronously) with model, data and options.
Example:
# Solve Sudoku puzzle with "mzn/sudoku.mzn" model, "mzn/sudoku.dzn" data,
# and custom solution handler Sudoku.solution_handler/2.
#
Minizinc.solve("mzn/sudoku.mzn", "mzn/sudoku.dzn", [solution_handler: &Sudoku.solution_handler/2])
Check out Sudoku
module in examples/sudoku.ex
for more details on handling solutions.
solve_sync(model)
Shortcut for solve_sync/2.
solve_sync(model, data, opts \\ [])
Specs
solve_sync(MinizincModel.mzn_model(), MinizincData.mzn_data(), solver_opts()) :: [any()]
Solve (synchronously) with model, data and options.
Example:
# Solve N-queens puzzle with n = 4.
# Use Gecode solver, solve within 1000 ms.
#
results = Minizinc.solve_sync("mzn/nqueens.mzn", %{n: 4}, [solver: "gecode", time_limit: 1000])
Check out NQueens
module in examples/nqueens.ex
for more details on handling solutions.
stop_solver_process(pid)
Stop solver process.