/// <summary> /// Assigns the values of the metric parts using special values (e.g. number of components in the context) /// </summary> /// <param name="context">The structuring context including the constraint</param> internal void AssignSpecialMetricValues(GKOStructuringContext context) { foreach (var part in this.RelationParts) { if (part is MetricRelationPart) { MetricRelationPart asMetricPart = part as MetricRelationPart; if (asMetricPart.IsSpecialValue) { asMetricPart.AssignFromSpecialValue(context); } } } }
public bool Equals(MetricRelationPart part) { // If parameter is null return false: if ((object)part == null) { return(false); } if (part.IsSpecialValue != this.IsSpecialValue) { return(false); } if (part.IsSpecialValue && this.IsSpecialValue) { return(part.GetAsSpecialValue() == this.GetAsSpecialValue()); } return(part.GetIntValue() == this.GetIntValue()); }
/// <summary> /// Gets the decision variable for the metric relation part /// </summary> /// <param name="metricPart"></param> /// <returns></returns> public static string GetDVarName(this MetricRelationPart metricPart) { return(String.Format("metric_val-{0}", metricPart.GetValue())); }