@@ -117,8 +117,8 @@ impl PartialOrd for Lit {
117117 }
118118}
119119
120- struct Clause {
121- lits : Vec < Lit > ,
120+ pub struct Clause {
121+ pub lits : Vec < Lit > ,
122122}
123123
124124impl Display for Clause {
@@ -245,8 +245,8 @@ impl Engine {
245245 true
246246 }
247247
248- pub fn get_conflict_explanation ( & self ) -> Option < Vec < Lit > > {
249- if self . learnt . is_empty ( ) { None } else { Some ( self . learnt . clone ( ) ) }
248+ pub fn get_conflict_explanation ( & mut self ) -> Option < Clause > {
249+ if self . learnt . is_empty ( ) { None } else { Some ( Clause { lits : mem :: take ( & mut self . learnt ) } ) }
250250 }
251251
252252 fn enqueue ( & mut self , lit : Lit , reason : Option < usize > ) -> bool {
@@ -556,8 +556,8 @@ mod tests {
556556 let explanation = engine. get_conflict_explanation ( ) . unwrap ( ) ;
557557 // The explanation should ideally contain the 1-UIP literal
558558 // and the "reason" variables from lower levels.
559- assert ! ( !explanation. is_empty( ) ) ;
560- println ! ( "Conflict explanation: {:? }" , explanation) ;
559+ assert ! ( !explanation. lits . is_empty( ) ) ;
560+ println ! ( "Conflict explanation: {}" , explanation) ;
561561 }
562562
563563 #[ test]
@@ -598,6 +598,6 @@ mod tests {
598598
599599 let explanation = engine. get_conflict_explanation ( ) . expect ( "There should be a conflict explanation" ) ;
600600 let expected_explanation = vec ! [ neg( x4) , pos( x9) , pos( x8) ] ;
601- assert_eq ! ( explanation, expected_explanation, "Conflict explanation should match expected" ) ;
601+ assert_eq ! ( explanation. lits , expected_explanation, "Conflict explanation should match expected" ) ;
602602 }
603603}
0 commit comments