namespace IStation.Algorithm
|
{
|
public class ScheduleCalc1
|
{
|
private int _belong = 0;
|
private int[] _run_flags = null;
|
private List<Model.Pump> _pumps = null;
|
|
/// <summary>
|
/// 初始化计算参数
|
/// </summary>
|
/// <param name="belong">所属对象</param>
|
/// <param name="pumps">泵列表</param>
|
/// <returns></returns>
|
private bool InitCalcParas(int belong, List<Model.Pump> pumps)
|
{
|
_belong = 0;
|
_pumps = null;
|
_run_flags = null;
|
_combine = null;
|
if (pumps == null || pumps.Count < 1)
|
return false;
|
_belong = belong;
|
_pumps = pumps;
|
_run_flags = pumps.Select(x => x.ID).OrderBy(x => x).ToArray();
|
_combine = new List<int>();
|
return true;
|
}
|
|
|
private List<int> _combine = null;
|
private bool CW(int belong, List<Model.Pump> pumps)
|
{
|
var bol = InitCalcParas(belong, pumps);
|
if (!bol) return false;
|
|
|
|
return true;
|
}
|
|
|
|
private void DoWork(int r, int i, int t)
|
{
|
if (r.Length / 2 >= t)
|
{
|
_combine.Add(r);
|
return;
|
}
|
for (; i < _run_flags.Length;)
|
{
|
DoWork(r + _run_flags[i], ++i, t);
|
}
|
}
|
}
|
}
|