提交 f67b9718 编写于 作者: M manjaro

加权调整有副作用

上级 9ae7961b
......@@ -173,17 +173,17 @@ size_t judge_tree(std::vector<chess_node> & tree)
{
if (tree[i].side==0)
{
float ratio = (tree[i].jump_cost[1]+1) / (tree[i].jump_cost[0]+1)/sqrt(tree[i].jump_cost[0]+1);
float ratio = sqrt((tree[i].jump_cost[1]+1) / (tree[i].jump_cost[0]+1)/ (tree[i].jump_cost[0]+1));
tree[i].weight = ratio;
}
else
{
float ratio = (tree[i].jump_cost[0]+1) / (tree[i].jump_cost[1]+1)/sqrt(tree[i].jump_cost[0]+1);
float ratio = sqrt((tree[i].jump_cost[0]+1) / (tree[i].jump_cost[1]+1)/ (tree[i].jump_cost[1]+1));
tree[i].weight = ratio;
}
size_t parent = tree[i].parent;
tree[parent].jump_cost[0] += tree[i].jump_cost[0] * tree[i].weight/tree[i].depth;
tree[parent].jump_cost[1] += tree[i].jump_cost[1] * tree[i].weight/tree[i].depth;
tree[parent].jump_cost[0] += tree[i].jump_cost[0] * tree[i].weight/tree[i].depth/tree[i].depth;
tree[parent].jump_cost[1] += tree[i].jump_cost[1] * tree[i].weight/tree[i].depth/tree[i].depth;
--i;
if (i%1000==0)
printf ("Sorting.%d... \r",total_nodes - i);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册