solverl v0.1.4 MinizincSolver

Minizinc solver API.

Link to this section Summary

Functions

Default Minizinc executable.

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'

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

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_executable()

Default Minizinc executable.

Link to this function

get_solverids()

Get list of solver ids for solvers available to MinizincSolver.

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'

Shortcut for solve/2.

Link to this function

solve(model, data, 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)

Shortcut for solve_sync/2.

Link to this function

solve_sync(model, data, 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

stop_solver_process(pid)

Stop solver process.