MinizincSolver (solverl v1.1.2)
Minizinc solver API.
Summary
Functions
Get list of solver ids for solvers available to MinizincSolver.
Get list of descriptions for solvers available to MinizincSolver.
Lookup a solver by (possibly partial) id; for results, it could be 'cplex' or 'org.minizinc.mip.cplex'
Solve (asynchronously) with model, data and options.
Solve (synchronously) with model, data and options.
Get solver status
Stop solver process.
Types
@type server_opts() :: GenServer.options()
@type solver_opt() :: {:minizinc_executable, binary()} | {:solver, binary()} | {:checker, MinizincModel.mzn_model()} | {:time_limit, integer()} | {:solution_handler, function() | module()} | {:solution_timeout, timeout()} | {:fzn_timeout, timeout()} | {:sync_to, pid() | nil} | {:extra_flags, binary()} | {:debug_exec, integer()} | {:cmd_opts, list()}
@type solver_opts() :: [solver_opt()]
Functions
Get list of solver ids for solvers available to MinizincSolver.
Get list of descriptions for solvers available to MinizincSolver.
Lookup a solver by (possibly partial) id; for results, it could be 'cplex' or 'org.minizinc.mip.cplex'
@spec solve( MinizincModel.mzn_model(), MinizincData.mzn_data(), solver_opts(), server_opts() ) :: {:ok, pid()} | {:error, any()}
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.
#
MinizincSolver.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.
@spec solve_sync( model :: MinizincModel.mzn_model(), data :: MinizincData.mzn_data(), solver_opts :: solver_opts(), server_opts :: server_opts() ) :: {:ok, any()} | {:error, any()}
Solve (synchronously) with model, data and options.
Example:
# Solve N-queens puzzle with n = 4.
# Use Gecode solver, solve within 1000 ms.
#
results = MinizincSolver.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.
Get solver status
Stop solver process.