fn prepare_model(&mut self, mut model: CausalModel) -> Option<CausalModel> {
    let mut unsatisfiable = false;
    let n = model.num_ops();
    for op1 in 0..n {
      for op2 in (op1+1)..n {
        if model.params.activated[op1] && model.params.activated[op2] {
          let v1 = model.params.var_of_op[op1].clone();
          let v2 = model.params.var_of_op[op2].clone();
          if v1 == v2 && model.params.is_rw_constrained(op1, op2)
          {
            debug!("{} / {} are read/write constrained.", op1, op2);
            let err_msg = "every variable access must have an explicit permission (should be done in `infer_permission.rs`).";
            let a1 = v1.permission.expect(err_msg);
            let a2 = v2.permission.expect(err_msg);
            // Enforce that every access read is done after readwrite, and in turn that every write is realized after a readwrite.
            if a1 > a2 {
              model.add_sequential_constraint(op1, op2);
            }
            else if a1 < a2 {
              model.add_sequential_constraint(op2, op1);
            }
            // Enforce that a variable is not accessed two times with readwrite.
            else if a1 == Permission::ReadWrite && a2 == Permission::ReadWrite {
              self.err_two_readwrite_accesses(v1, v2);
              unsatisfiable = true;
            }
          }
        }
      }
    }
    if unsatisfiable { None }
    else { Some(model) }
  }
/// Returns `None` if the model is detected unsatisfiable.
/// In this case, an error is reported.
Returns `None` if the model is detected unsatisfiable.
In this case, an error is reported.
Returns ` None ` if the model is detected unsatisfiable . In this case an error is reported .
fn prepare_model(&mut self, mut model: CausalModel) -> Option<CausalModel> {
    let mut unsatisfiable = false;
    let n = model.num_ops();
    for op1 in 0..n {
      for op2 in (op1+1)..n {
        if model.params.activated[op1] && model.params.activated[op2] {
          let v1 = model.params.var_of_op[op1].clone();
          let v2 = model.params.var_of_op[op2].clone();
          if v1 == v2 && model.params.is_rw_constrained(op1, op2)
          {
            debug!("{} / {} are read/write constrained.", op1, op2);
            let err_msg = "every variable access must have an explicit permission (should be done in `infer_permission.rs`).";
            let a1 = v1.permission.expect(err_msg);
            let a2 = v2.permission.expect(err_msg);
            // Enforce that every access read is done after readwrite, and in turn that every write is realized after a readwrite.
            if a1 > a2 {
              model.add_sequential_constraint(op1, op2);
            }
            else if a1 < a2 {
              model.add_sequential_constraint(op2, op1);
            }
            // Enforce that a variable is not accessed two times with readwrite.
            else if a1 == Permission::ReadWrite && a2 == Permission::ReadWrite {
              self.err_two_readwrite_accesses(v1, v2);
              unsatisfiable = true;
            }
          }
        }
      }
    }
    if unsatisfiable { None }
    else { Some(model) }
  }
fn prepare_model ( & mut self , mut model : CausalModel ) -> Option < CausalModel > { let mut unsatisfiable = false ; let n = model . num_ops ( ) ; for op1 in 0 .. n { for op2 in ( op1 + 1 ) .. n { if model . params . activated [ op1 ] && model . params . activated [ op2 ] { let v1 = model . params . var_of_op [ op1 ] . clone ( ) ; let v2 = model . params . var_of_op [ op2 ] . clone ( ) ; if v1 == v2 && model . params . is_rw_constrained ( op1 , op2 ) { debug ! ( " " op1 op2 ) ; let err_msg = " " ; let a1 = v1 . permission . expect ( err_msg ) ; let a2 = v2 . permission . expect ( err_msg ) ; // Enforce that every access read is done after readwrite, and in turn that every write is realized after a readwrite. if a1 > a2 { model . add_sequential_constraint ( op1 , op2 ) ; } else if a1 < a2 { model . add_sequential_constraint ( op2 , op1 ) ; } // Enforce that a variable is not accessed two times with readwrite. else if a1 == Permission :: ReadWrite && a2 == Permission :: ReadWrite { self . err_two_readwrite_accesses ( v1 , v2 ) ; unsatisfiable = true ; } } } } } if unsatisfiable { None } else { Some ( model ) } }
Returns `None` if the model is detected unsatisfiable.
Returns ` None ` if the model is detected unsatisfiable .
&mut self
model
CausalModel
&mut self
model
CausalModel