diff --git a/ortools/sat/csharp/CpModel.cs b/ortools/sat/csharp/CpModel.cs
index 5028419b9a..d7c7d9f126 100644
--- a/ortools/sat/csharp/CpModel.cs
+++ b/ortools/sat/csharp/CpModel.cs
@@ -501,6 +501,11 @@ public ReservoirConstraint AddReservoirConstraint(long minLevel, long maxLevel)
return ct;
}
+ /**
+ *
+ * Adds var == i + offset ⇔ bool_vars[i] == true for all i.
+ *
+ */
public void AddMapDomain(IntVar var, IEnumerable bool_vars, long offset = 0)
{
int i = 0;
@@ -523,11 +528,11 @@ public void AddMapDomain(IntVar var, IEnumerable bool_vars, long offset
model_.Constraints.Add(ct1);
LinearConstraintProto lin2 = new LinearConstraintProto();
- lin1.Vars.Capacity = 1;
+ lin2.Vars.Capacity = 1;
lin2.Vars.Add(var_index);
- lin1.Coeffs.Capacity = 1;
+ lin2.Coeffs.Capacity = 1;
lin2.Coeffs.Add(1L);
- lin1.Domain.Capacity = 4;
+ lin2.Domain.Capacity = 4;
lin2.Domain.Add(Int64.MinValue);
lin2.Domain.Add(offset + i - 1);
lin2.Domain.Add(offset + i + 1);
@@ -1057,7 +1062,7 @@ public void AddHint(ILiteral lit, bool value)
model_.SolutionHint.Vars.Add(Negated(index));
model_.SolutionHint.Values.Add(value ? 0 : 1);
}
- }
+ }
/** Clears all hinting from the model.*/
public void ClearHints()