minor improvement to C# CP-SAT code and test

This commit is contained in:
Laurent Perron
2021-10-17 11:24:44 +02:00
parent 6effc30e82
commit f15537de74
2 changed files with 4 additions and 5 deletions

View File

@@ -442,10 +442,9 @@ namespace Google.OrTools.Tests
CpModel model = new CpModel();
IntVar v = model.NewIntVar(-10, 10, "v");
IntervalVar i = model.NewFixedSizeIntervalVar(v, 3, "i");
Console.WriteLine("Start = " + i.StartExpr().ToString() + "/" + i.StartExpr().ShortString());
Console.WriteLine("Size = " + i.SizeExpr().ToString() + "/" + i.SizeExpr().ShortString());
Console.WriteLine("End = " + i.EndExpr().ToString() + "/" + i.EndExpr().ShortString());
Console.WriteLine("Interval = " + i.ToString());
Assert.Equal("v", i.StartExpr().ShortString());
Assert.Equal("3", i.SizeExpr().ShortString());
Assert.Equal("(v + 3)", i.EndExpr().ShortString());
}
}
} // namespace Google.OrTools.Tests

View File

@@ -379,7 +379,7 @@ namespace Google.OrTools.Sat
long offset = proto.Offset;
if (numElements == 0)
{
return new ConstantExpr(offset);
return LinearExpr.Constant(offset);
}
else
if (numElements == 1)