Diff
checker
文本
文本
圖像
文檔
Excel
文件夾
Legal
Enterprise
桌面版
定價
登入
下載 Diffchecker 桌面版
比較文本
尋找兩個文字檔案之間的差異
工具
歷史
即時編輯器
隱藏空白變更
摺疊未變更行
關閉換行
檢視
拆分
統一
比對精度
智能
單詞
字符
文字樣式
變更外觀
語法突出顯示
選擇語法
忽略
文字轉換
前往第一個差異
編輯輸入
Diffchecker Desktop
執行Diffchecker最安全的方式。取得Diffchecker桌面應用程式:您的差異永遠不會離開您的電腦!
取得桌面版
Untitled diff
建立於
9 年前
差異永不過期
清除
匯出
分享
解釋
2 刪除
行
總計
刪除
字符
總計
刪除
要繼續使用此功能,請升級到
Diff
checker
Pro
查看價格
59 行
全部複製
10 新增
行
總計
新增
字符
總計
新增
要繼續使用此功能,請升級到
Diff
checker
Pro
查看價格
60 行
全部複製
複製
已複製
複製
已複製
Policy
Iteration
Value
Iteration
複製
已複製
複製
已複製
public boolean performReachabilityFrom(State si){
public boolean performReachabilityFrom(State si){
HashableState sih = this.stateHash(si);
HashableState sih = this.stateHash(si);
//if this is not a new state and we are not required to perform a new reachability analysis, then this method does not need to do anything.
//if this is not a new state and we are not required to perform a new reachability analysis, then this method does not need to do anything.
if(valueFunction.containsKey(sih) && this.foundReachableStates){
if(valueFunction.containsKey(sih) && this.foundReachableStates){
return false; //no need for additional reachability testing
return false; //no need for additional reachability testing
}
}
DPrint.cl(this.debugCode, "Starting reachability analysis");
DPrint.cl(this.debugCode, "Starting reachability analysis");
//add to the open list
//add to the open list
LinkedList <HashableState> openList = new LinkedList<HashableState>();
LinkedList <HashableState> openList = new LinkedList<HashableState>();
Set <HashableState> openedSet = new HashSet<HashableState>();
Set <HashableState> openedSet = new HashSet<HashableState>();
openList.offer(sih);
openList.offer(sih);
openedSet.add(sih);
openedSet.add(sih);
while(!openList.isEmpty()){
while(!openList.isEmpty()){
HashableState sh = openList.poll();
HashableState sh = openList.poll();
//skip this if it's already been expanded
//skip this if it's already been expanded
if(valueFunction.containsKey(sh)){
if(valueFunction.containsKey(sh)){
continue;
continue;
}
}
複製
已複製
複製
已複製
//do not need to expand from terminal states
//do not need to expand from terminal states
if set to prune
if(
model.terminal(sh.s())
){
if(
this.
model.terminal(sh.s())
&& stopReachabilityFromTerminalStates
){
continue;
continue;
}
}
複製
已複製
複製
已複製
valueFunction.put(sh,
valueInitializer.value(sh.s()));
this.
valueFunction.put(sh,
this.
valueInitializer.value(sh.s()));
List<Action> actions = this.applicableActions(sh.s());
List<Action> actions = this.applicableActions(sh.s());
for(Action a : actions){
for(Action a : actions){
List<TransitionProb> tps = ((FullModel)model).transitions(sh.s(), a);
List<TransitionProb> tps = ((FullModel)model).transitions(sh.s(), a);
for(TransitionProb tp : tps){
for(TransitionProb tp : tps){
HashableState tsh = this.stateHash(tp.eo.op);
HashableState tsh = this.stateHash(tp.eo.op);
if(!openedSet.contains(tsh) && !valueFunction.containsKey(tsh)){
if(!openedSet.contains(tsh) && !valueFunction.containsKey(tsh)){
openedSet.add(tsh);
openedSet.add(tsh);
openList.offer(tsh);
openList.offer(tsh);
}
}
}
}
}
}
複製
已複製
複製
已複製
}
}
DPrint.cl(this.debugCode, "Finished reachability analysis; # states: " + valueFunction.size());
DPrint.cl(this.debugCode, "Finished reachability analysis; # states: " + valueFunction.size());
this.foundReachableStates = true;
this.foundReachableStates = true;
複製
已複製
複製
已複製
this.hasRunVI = false;
return true;
return true;
}
}
已保存差異
原始文本
開啟檔案
Policy Iteration public boolean performReachabilityFrom(State si){ HashableState sih = this.stateHash(si); //if this is not a new state and we are not required to perform a new reachability analysis, then this method does not need to do anything. if(valueFunction.containsKey(sih) && this.foundReachableStates){ return false; //no need for additional reachability testing } DPrint.cl(this.debugCode, "Starting reachability analysis"); //add to the open list LinkedList <HashableState> openList = new LinkedList<HashableState>(); Set <HashableState> openedSet = new HashSet<HashableState>(); openList.offer(sih); openedSet.add(sih); while(!openList.isEmpty()){ HashableState sh = openList.poll(); //skip this if it's already been expanded if(valueFunction.containsKey(sh)){ continue; } //do not need to expand from terminal states if(model.terminal(sh.s())){ continue; } valueFunction.put(sh, valueInitializer.value(sh.s())); List<Action> actions = this.applicableActions(sh.s()); for(Action a : actions){ List<TransitionProb> tps = ((FullModel)model).transitions(sh.s(), a); for(TransitionProb tp : tps){ HashableState tsh = this.stateHash(tp.eo.op); if(!openedSet.contains(tsh) && !valueFunction.containsKey(tsh)){ openedSet.add(tsh); openList.offer(tsh); } } } } DPrint.cl(this.debugCode, "Finished reachability analysis; # states: " + valueFunction.size()); this.foundReachableStates = true; return true; }
更改後文本
開啟檔案
Value Iteration public boolean performReachabilityFrom(State si){ HashableState sih = this.stateHash(si); //if this is not a new state and we are not required to perform a new reachability analysis, then this method does not need to do anything. if(valueFunction.containsKey(sih) && this.foundReachableStates){ return false; //no need for additional reachability testing } DPrint.cl(this.debugCode, "Starting reachability analysis"); //add to the open list LinkedList <HashableState> openList = new LinkedList<HashableState>(); Set <HashableState> openedSet = new HashSet<HashableState>(); openList.offer(sih); openedSet.add(sih); while(!openList.isEmpty()){ HashableState sh = openList.poll(); //skip this if it's already been expanded if(valueFunction.containsKey(sh)){ continue; } //do not need to expand from terminal states if set to prune if(this.model.terminal(sh.s()) && stopReachabilityFromTerminalStates){ continue; } this.valueFunction.put(sh, this.valueInitializer.value(sh.s())); List<Action> actions = this.applicableActions(sh.s()); for(Action a : actions){ List<TransitionProb> tps = ((FullModel)model).transitions(sh.s(), a); for(TransitionProb tp : tps){ HashableState tsh = this.stateHash(tp.eo.op); if(!openedSet.contains(tsh) && !valueFunction.containsKey(tsh)){ openedSet.add(tsh); openList.offer(tsh); } } } } DPrint.cl(this.debugCode, "Finished reachability analysis; # states: " + valueFunction.size()); this.foundReachableStates = true; this.hasRunVI = false; return true; }
尋找差異