minizinc#
Source code: sensai/minizinc.py
- class CostScaler(cost_values: List[float], significant_digits: int)[source]#
Bases:
object
Serves to scale floats and converts them into integers (and vice versa) whilst maintaining decimal precision
- Parameters:
cost_values: the sequence of cost values whose precision should be maintained in the int realm significant_digits: the number of significant digits that shall at least be maintained
- class MiniZincProblem[source]#
Bases:
ABC
- class MiniZincSolver(name='OSICBC', solver_time_seconds=None, fzn_output_path=None)[source]#
Bases:
object
- Parameters:
name – name of solver compatible with miniZinc
solver_time_seconds – upper time limit for solver in seconds
fzn_output_path – flatZinc output path
- log = <Logger sensai.minizinc.MiniZincSolver (WARNING)>#
- solve_path(mzn_path: str, log_info=True) str [source]#
Solves the MiniZinc problem stored at the given file path
- Parameters:
mzn_path – path to file containing MiniZinc problem code
log_info – whether to log solver output at INFO level rather than DEBUG level
- Returns:
the solver output
- solve_problem(problem: MiniZincProblem, keep_temp_file=False, log_info=True) str [source]#
Solves the given MiniZinc problem
- Parameters:
problem – the problem to solve
keep_temp_file – whether to keep the temporary .mzv file
log_info – whether to log solver output at INFO level rather than DEBUG level
- Returns:
the solver output