solverl v1.0.0 MinizincSolver

Minizinc solver API.

Link to this section 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.

Link to this section Types

Link to this type

server_opts()

Specs

server_opts() :: GenServer.options()
Link to this type

solver_opt()

Specs

solver_opt() ::
  {:minizinc_executable, binary()}
  | {:solver, binary()}
  | {:time_limit, integer()}
  | {:solution_handler, function()}
  | {:extra_flags, binary()}
Link to this type

solver_opts()

Specs

solver_opts() :: [solver_opt()]

Link to this section Functions

Link to this function

get_solverids()

Get list of solver ids for solvers available to MinizincSolver.

Link to this function

get_solvers(minizinc_executable \\ MinizincUtils.default_executable())

Get list of descriptions for solvers available to MinizincSolver.

Link to this function

lookup(solver_id)

Lookup a solver by (possibly partial) id; for results, it could be 'cplex' or 'org.minizinc.mip.cplex'

Link to this function

solve(model, data \\ [], solver_opts \\ [], opts \\ [])

Specs

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.

Link to this function

solve_sync(model, data \\ [], solver_opts \\ [], opts \\ [])

Specs

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.

Link to this function

solver_status(solver_pid)

Get solver status

Link to this function

stop_solver(pid)

Stop solver process.

Link to this function

update_solution_handler(pid, handler)