?? simplexelement.cs
字號:
using System;
using System.Collections;
namespace NSLinearProgramming
{
public class CSimplexColumnCollection : CStandardCollection<CSimplexColumn>
{
public CSimplexColumnCollection()
: base()
{
}
public CSimplexColumnCollection(int iCount)
: base(iCount)
{
}
}
public class CSimplexRowCollection : CStandardCollection<CSimplexRow>
{
public CSimplexRowCollection()
: base()
{
}
public CSimplexRowCollection(int iCount)
: base(iCount)
{
}
}
public class CSimplexColumn : CStandardElement
{
private double m_dValue;
private double m_InJudge;
private bool m_bIsBaseVariable = false;
public CSimplexColumn()
{
}
#region 屬性
public double Value
{
get { return this.m_dValue; }
set { this.m_dValue = value; }
}
public double InJudge
{
get { return m_InJudge; }
set { m_InJudge = value; }
}
public bool IsBaseVariable
{
get { return m_bIsBaseVariable; }
set { m_bIsBaseVariable = value; }
}
#endregion
#region IDisposable 成員
public override void Dispose()
{
}
#endregion
}
public class CSimplexRow : CStandardElement
{
private double[] m_daConstraints;
private double m_dResource;
private double m_OutJudge;
private CSimplexColumn m_Col = null;//行對應的基變量列
public CSimplexRow(double[] daConstraints)
{
m_daConstraints = daConstraints;
}
public CSimplexRow(int iConstraintNumbers)
{
m_daConstraints = new double[iConstraintNumbers];
}
public void GetOutJudge(int iInVariablePosition)
{
this.OutJudge = double.PositiveInfinity;//正無窮
if (this[iInVariablePosition] > 0)
{
double dθ = this.Resource / this[iInVariablePosition];
//修改,2007-05-13,注釋掉了下行
//if (dθ > 0)
this.OutJudge = dθ;
}
}
#region 屬性
public double Resource
{
get { return m_dResource; }
set { m_dResource = value; }
}
public CSimplexColumn BaseVariableColumn
{
get { return m_Col; }
set { m_Col = value; }
}
public double BaseVariableValue
{
get
{
System.Diagnostics.Debug.Assert(m_Col != null);
return m_Col.Value;
}
}
public double this[int index]
{
get
{
int iActualIndex = index;//下標從0開始
System.Diagnostics.Debug.Assert(iActualIndex >= 0 && iActualIndex < m_daConstraints.Length);
}
set
{
int iActualIndex = index;//下標從0開始
System.Diagnostics.Debug.Assert(iActualIndex >= 0 && iActualIndex < m_daConstraints.Length);
m_daConstraints[iActualIndex] = value;
}
}
public double OutJudge
{
get { return m_OutJudge; }
set { m_OutJudge = value; }
}
#endregion
#region IDisposable 成員
public override void Dispose()
{
m_daConstraints = null;
}
#endregion
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -