1

I have to solve a problem with SAT. That problem has 2 cardinality constraints, first one is: at most 6 "class of same stage" per day, "university" is "open" 12h per day, so you have to generate constraints to apply them to SAT solver.

Second cardinality constraint is: every subject must have at least X hours a week.

I've been reading and best way for first might be "Sorting networks algorithm" and I don't know about second though I don't know how to implement neither even begin to implement it in prolog.

  • 2
    Are you using a CLP(B) system like the one of SICStus Prolog? In SICStus Prolog, `library(clpb)` provides the Boolean expression `card(Is,Exprs)`, which you can use like `sat(card([X-N],Hours)`, stating that between `X` and `N` Boolean expressions in `Hours` are **true**. Alternatively, you can also express such a cardinality constraint with other clauses, but this quickly gets out of hand due to an exponential number of necessary clauses. – mat Oct 25 '15 at 12:46

0 Answers0