//public void GenDS() //{ // _ds.Clear(); // _ds.Add(new Decision()); // IMDPDecisionSpace tempSet = new DecisionSpace(); // for (int i = 0; i < ProSpace.Count; i++) // { // tempSet.Clear(); // foreach (Decision dic in _ds) // { // Decision temp = new Decision(dic); // temp.OpenProductSet.Add(ProSpace[i]); // tempSet.Add(temp); // } // _ds.UnionWith(tempSet); // } //} //public void GenSS() //{ // _ss.Clear(); // IMDPState temp = GenZeroState(); // _ss.Add(temp); // foreach (Resource ts in ResSpace) // { // GenSSOneDemension(ts); // } //} //public void GenSS1()//依赖于InitialState //{ // _ss.Clear(); // State state = new State(); // foreach (Resource ts in (InitialState as State).Keys) // { // state.Add(ts, (InitialState as State)[ts]); // //GenFirstSS(ts, (InitialState as State)[ts]); // } // //_ss.Add(GenZeroState()); // _ss.Add(state); //} //public void GenSS2(ResouceState RecDic) //{ // _ss.Clear(); // State state = new State(); // foreach (Resource ts in RecDic.Keys) // { // state.Add(ts, RecDic[ts]); // //GenFirstSS(ts, RecDic[ts]); // } // //_ss.Add(GenZeroState()); // _ss.Add(state); //} public IMDPState GenInitialState(MetaResouceState s) { State state = new State(); foreach (Resource ts in ResSpace) { state.Add(ts, s.GetRemainNum(ts));//修改正确 } return(state); }
public IALPState CreateOrFind(MetaResouceState RecDic) { State state = new State(); foreach (Resource ts in this.ResSpace) { state.Add(ts, RecDic.GetRemainNum(ts));//这里没有管安全性 } IMDPState res = _ss.FirstOrDefault(i => i.Equals(state)); if (res == null) { _ss.Add(state); return(state); } else { return(res as IALPState); } }