/// <summary> Returns a Copy of this network. /// The new network has the same structure as the original network. /// </summary> /// <returns> a Copy of this network /// </returns> public virtual Object Clone() { var net = new Network(); var vs = variables.GetEnumerator(); while (vs.MoveNext()) { var v = (Variable)vs.Current; Variable v1 = v.Copy(net); if (v.Index != v1.Index) { throw new ArgumentException(); } } var cs = constraints.GetEnumerator(); while (cs.MoveNext()) { var c = (Constraint)cs.Current; Constraint c1 = c.Copy(net); if (c.Index != c1.Index) { throw new ArgumentException(); } } if (objective != null) { net.Objective = net.GetVariable(objective.Index); } return(net); }
protected internal static Variable[] Copy(Variable[] v0, Network net) { var v = new Variable[v0.Length]; for (int i = 0; i < v0.Length; i++) { int j = v0[i].Index; v[i] = net.GetVariable(j); } return(v); }
protected internal static Variable[] Copy(Variable[] v0, Network net) { var v = new Variable[v0.Length]; for (int i = 0; i < v0.Length; i++) { int j = v0[i].Index; v[i] = net.GetVariable(j); } return v; }
protected internal static Variable Copy(Variable v0, Network net) { int j = v0.Index; return net.GetVariable(j); }
/// <summary> Returns a Copy of this network. /// The new network has the same structure as the original network. /// </summary> /// <returns> a Copy of this network /// </returns> public virtual Object Clone() { var net = new Network(); var vs = _variables.GetEnumerator(); while (vs.MoveNext()) { var v = (Variable) vs.Current; Variable v1 = v.Copy(net); if (v.Index != v1.Index) throw new ArgumentException(); } var cs = _constraints.GetEnumerator(); while (cs.MoveNext()) { var c = (Constraint) cs.Current; Constraint c1 = c.Copy(net); if (c.Index != c1.Index) throw new ArgumentException(); } if (_objective != null) { net.Objective = net.GetVariable(_objective.Index); } return net; }
protected internal static Variable Copy(Variable v0, Network net) { int j = v0.Index; return(net.GetVariable(j)); }