Class WcnfParser

Namespace
LogicalOptimizer
Assembly
LogicalOptimizer.Formats.dll

Streaming parser for the WCNF (weighted partial MaxSAT) format. Two dialects are accepted, the classic one first and by default:

  • Classic — a p wcnf <nvars> <nclauses> <top> header (the trailing top is optional; when absent every clause is soft), then one <weight> <lit...> 0 clause per record (records may span lines). A clause whose weight equals top is hard.
  • New-style (MaxSAT Evaluation 2022+) — no p line; one clause per line, a leading h marking a hard clause and a leading positive integer marking a soft clause of that weight. A trailing 0 is tolerated but not required. top is synthesized as (Σ soft weights)+1 so the writer can round-trip through the classic form.
c comment lines are ignored. Reads line by line and never materializes the whole input; budget/variable overruns raise ComputationBudgetExceededException and other malformation raises FormatParseException.
public static class WcnfParser
Inheritance
WcnfParser
Inherited Members

Methods

Parse(TextReader, ResourceBudget?, CancellationToken)

public static WeightedCnfProblem Parse(TextReader reader, ResourceBudget? budget = null, CancellationToken cancellationToken = default)

Parameters

reader TextReader
budget ResourceBudget
cancellationToken CancellationToken

Returns

WeightedCnfProblem