Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

k>2个agent同时占用某个vertix的情况,以及分裂子node的best node选择 #9

Open
StetroF opened this issue Nov 29, 2024 · 1 comment

Comments

@StetroF
Copy link

StetroF commented Nov 29, 2024


你好!最近在看cbs算法,看了cbs文献后发现你的代码和文献似乎不太一样,
首先第一个就是没考虑到k>2个,比如3个agent的原始path同时占用一个点的情况啦~,也许是因为demo过程中这种情况比较少所以没考虑吗
`

        // console.log("constraint_dict:", constraint_dict);
        var constraint_dict = this.env.createConstraintFromConflict(conflict);

        //根据冲突分裂结点
        for (var agent in constraint_dict) {
            var newNode = _.cloneDeep(p);
            newNode.constraint_dict[agent].addConstraint(constraint_dict[agent]);

            this.env.constraint_dict = newNode.constraint_dict; //切换环境
            // newNode.solution = this.env.calcSolution(); //重新计算路径解
            newNode.solution = this.env.calcOneSolution(p.solution, agent)

            console.log("newNode:", newNode);

            if (!newNode.solution) {
                continue;
            }
            newNode.cost = this.env.calcSolutionCost(newNode.solution);

            console.log("newNode:", newNode);
            console.log("cost:", newNode.cost);

            if (!this.isInArray(this.openSet, newNode)) {
                this.openSet.push(newNode);
            }


        }

`

第二的话,如上图,我们现在只考虑两个agent的情况,当发现conflict时,你使用createConstraintFromConflict得到一组分裂的约束和子node后,你的for循环是把两个node都放入到this.openset中,但是,论文原文是说,当得到两个node后,会各自用自己的约束计算path,并取两个node中cost更小的那个node,加入到this.openset中,这里是不是可以优化的呢。

@StetroF
Copy link
Author

StetroF commented Nov 29, 2024

呃呃,重新看了下,while循环时会找cost最小的那个node

你好!最近在看cbs算法,看了cbs文献后发现你的代码和文献似乎不太一样, 首先第一个就是没考虑到k>2个,比如3个agent的原始path同时占用一个点的情况啦~,也许是因为demo过程中这种情况比较少所以没考虑吗 `

        // console.log("constraint_dict:", constraint_dict);
        var constraint_dict = this.env.createConstraintFromConflict(conflict);

        //根据冲突分裂结点
        for (var agent in constraint_dict) {
            var newNode = _.cloneDeep(p);
            newNode.constraint_dict[agent].addConstraint(constraint_dict[agent]);

            this.env.constraint_dict = newNode.constraint_dict; //切换环境
            // newNode.solution = this.env.calcSolution(); //重新计算路径解
            newNode.solution = this.env.calcOneSolution(p.solution, agent)

            console.log("newNode:", newNode);

            if (!newNode.solution) {
                continue;
            }
            newNode.cost = this.env.calcSolutionCost(newNode.solution);

            console.log("newNode:", newNode);
            console.log("cost:", newNode.cost);

            if (!this.isInArray(this.openSet, newNode)) {
                this.openSet.push(newNode);
            }


        }

`

第二的话,如上图,我们现在只考虑两个agent的情况,当发现conflict时,你使用createConstraintFromConflict得到一组分裂的约束和子node后,你的for循环是把两个node都放入到this.openset中,但是,论文原文是说,当得到两个node后,会各自用自己的约束计算path,并取两个node中cost更小的那个node,加入到this.openset中,这里是不是可以优化的呢。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant