本文整理汇总了C#中Cream.Network.GetVariable方法的典型用法代码示例。如果您正苦于以下问题:C# Network.GetVariable方法的具体用法?C# Network.GetVariable怎么用?C# Network.GetVariable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cream.Network
的用法示例。
在下文中一共展示了Network.GetVariable方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Copy
protected internal static Variable Copy(Variable v0, Network net)
{
int j = v0.Index;
return net.GetVariable(j);
}
示例2: Clone
/// <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;
}