/// <summary> /// Add a goal that minimizes the distance between two nodes, i.e. weight*((id1-id2)^2). /// </summary> /// <param name="id1">Caller's unique identifier for the first node.</param> /// <param name="id2">Caller's unique identifier for the second node.</param> /// <param name="weight">The weight of the corresponding term in the goal function</param> public void AddGoalTwoVariablesAreClose(int id1, int id2, double weight) { var var1 = GetVariable(id1); if (var1 == null) { return; } var var2 = GetVariable(id2); if (var2 == null) { return; } solver.AddNeighborPair(var1, var2, weight); }