WCNF (cpmpy.tools.io.wcnf)
Helper functions for the WCNF format.
WCNF is a textual format to represent MaxSAT problems. More can be read about it here:
List of functions
Loader for WCNF format. |
For writing, use write_dimacs().
- cpmpy.tools.io.wcnf.load_wcnf(wcnf: str | PathLike | TextIO, open: Callable = <built-in function open>) Model[source]
Loader for WCNF format. Loads an instance and returns its matching CPMpy model.
- Parameters:
wcnf (str or os.PathLike or TextIO) –
A file path to an WCNF file (optionally LZMA-compressed with .xz), or
A string containing the WCNF content directly, or
A TextIO object already open for reading
open (Callable) – callable to open the file for reading (default: builtin
open).
- Returns:
The CPMpy model of the WCNF instance.
- Return type:
cp.Model