共查询到18条相似文献,搜索用时 62 毫秒
1.
曹健 《电脑编程技巧与维护》2014,(9)
正可以这样理解回溯法:将某一问题分成n个步骤,而每个步骤都有m个待定值,如果每个步骤都求得了满意的值,那么整个问题就得到了一个解。于是就可以从第一个步骤开始,从第一个值开始依次试探每个值,如果获取到一个符合条件的值,那么就进到下一个步骤,继续进行试探;如果某一步骤的m个值都试探到了,还是不能满足条件,那么就回退到 相似文献
2.
3.
4.
5.
6.
8皇后问题是计算机算法设计领域里的经典问题。利用回溯算法和概率算法相结合的办法求解8皇后问题,通过实验分析第一次成功搜索到皇后位置的概率,以实验得出的数据为依据对现存的观点提出了质疑,并对实验数据进行了分析,肯定了本文数据的合理性。 相似文献
7.
回溯算法是基本的算法之一,其重要的思想是不断地用限界函数去测试正在构造的部分解向量,看是否导致合法解,回溯算法通常具有较高的时间复杂度,但对于至今除了穷尽搜索仍未找到其他的方法的问题,回溯算法是较为有效的方法.介绍了回溯算法,以及以经典的N皇后问题为例,讲解了用回溯算法求解问题,并分析了其空间复杂度,介绍了求解N皇后问题的改进回溯算法. 相似文献
8.
王一盟 《电脑编程技巧与维护》2018,(7):52-56,76
使用Python开发语言,通过动态电路模型建模,采用递归回溯算法,编程解决了一道今年在网上比较火热的逻辑推理问题,并给出了最优的推理过程.这个建模和递归回溯方法,可以模拟人的逻辑推理过程,对解决同类的逻辑推理问题,有比较普遍的适用性. 相似文献
9.
八皇后问题的非递归算法设计 总被引:1,自引:0,他引:1
采用回溯法来解决八皇后问题,用一种较好的数据类型来表示解空间,给出一种逻辑结构非常清晰的非递归算法,解决了递归算法中空间效率低的问题。 相似文献
10.
利用一种简易的递归回溯算法,给出C语言实现N皇后问题的伪代码和完整程序,并在程序中准确地显示出皇后的各种摆法.程序逻辑清晰,结构明了,便于理解掌握,对于学习C语言编程具有很好的帮助促进作用. 相似文献
11.
陈宇文 《电脑编程技巧与维护》2013,(14):14-17
解空间树分为子集树和排列树。进一步将子集树分为二叉树、多枝树。对回溯法在这两种解空间树中的应用给出了规律性的方法与步骤,从而使回溯法更加简单易用,并且从易到难给出了相应的实例,以及应用这些规律性方法得出的源代码。 相似文献
12.
Ateet Bhalla Inês Lynce José T. de Sousa João Marques-Silva 《Journal of Automated Reasoning》2005,35(1-3):3-24
In recent years backtrack search algorithms for propositional satisfiability (SAT) have been the subject of dramatic improvements.
These improvements allowed SAT solvers to successfully solve instances with thousands or tens of thousands of variables. However,
many new challenging problem instances are still too hard for current SAT solvers. As a result, further improvements to SAT
technology are expected to have key consequences in solving hard real-world instances. This paper introduces a new idea: choosing
the backtrack variable using a heuristic approach with the goal of diversifying the regions of the space that are explored
during the search. The proposed heuristics are inspired by the heuristics proposed in recent years for the decision branching
step of SAT solvers, namely, VSIDS and its improvements. Completeness conditions are established, which guarantee completeness
for the new algorithm, as well as for any other incomplete backtracking algorithm. Experimental results on hundreds of instances
derived from real-world problems show that the new technique is able to speed SAT solvers, while aborting fewer instances.
These results clearly motivate the integration of heuristic backtracking in SAT solvers. 相似文献
13.
为了充分发挥高性能计算机的计算能力,缓解程序员设计和编写并行程序的压力,扩充可用软件集合,设计并实现了利用交互界面深入挖掘程序中的可向量化语句,优化生成代码中的向量化语句,提高生成代码的执行效率.该方法对充分发挥高性能计算机的计算能力,增强系统可用性和扩展应用范围具有重要的意义,同时能够提供有效的辅助手段和工具支持.渐进式智能回溯向量化代码调优架构通过对用户提交的串行程序进行程序分析和变换,采用串行程序分析、数据依赖分析、向量化分析等技术手段,根据分析结果对程序进行变换和优化,自动生成最终的向量化代码.该方法通过分析串行程序中潜在的并行性,将其自动变换为等价的向量化代码形式,大大简化了程序员的工作. 相似文献
14.
Ordering heuristics are a powerful tool in CSP search algorithms. Among the most successful ordering heuristics are heuristics which enforce a fail first strategy by using the Min-domain property (Haralick and Elliott, Artif Intel 14:263–313, 1980; Bessiere and Regin, Mac and combined heuristics: two reasons to forsake FC (and CBJ?) on hard problems. In Proc. CP 96, pp. 61–75, Cambridge, MA, 1996; Smith and Grant, Trying harder to fail first. In European Conference on Artificial Intelligence, pp. 249–253, 1998; Dechter, Constraint Processing. Morgan Kaufman, 2003). Ordering heuristics have been introduced recently to asynchronous backtracking (ABT), for distributed constraints satisfaction (DisCSP) (Zivan and Meisels, Dynamic ordering for asynchronous backtracking on discsps. In CP-2005, pp. 32–46, Sigtes (Barcelona), Spain, 2005). However, the pioneering study of dynamically ordered ABT, ABT_DO, has shown that a straightforward implementation of the Min-domain heuristic does not produce the expected improvement over a static ordering. The present paper proposes an asynchronous dynamic ordering which does not follow the standard restrictions on the position of reordered agents in ABT_DO. Agents can be moved to a position that is higher than that of the target of the backtrack. Combining the Nogood-triggered heuristic and the Min-domain property in this new class of heuristics results in the best performing version of ABT_DO. The new version of retroactively ordered ABT is faster by a large factor than the best form of ABT. 相似文献
15.
An algorithm that performs asynchronous backtracking on distributed
, with dynamic ordering of agents is proposed,
. Agents propose reorderings of lower priority agents and send these proposals whenever they send assignment messages. Changes
of ordering triggers a different computation of
. The dynamic ordered asynchronous backtracking algorithm uses polynomial space, similarly to standard
. The
algorithm with three different ordering heuristics is compared to standard
on randomly generated
. A Nogood-triggered heuristic, inspired by dynamic backtracking, is found to outperform static order
by a large factor in run-time and improve the network load. 相似文献
16.
This article proposes a new mathematical definition of the execution of pure Prolog, in the form of axioms in a structural operational semantics. The main advantage of the model is its ease in representing backtracking, due to the functionality of the transition relation and its converse. Thus, forward and backward derivation steps are possible. A novel concept of stages is introduced, as a refinement of final states, which captures the evolution of a backtracking computation. An advantage over the traditional stack-of-stacks approaches is a modularity property. Finally, the model combines the intuition of the traditional ‘Byrd box’ metaphor with a compact representation of execution state, making it feasible to formulate and prove theorems about the model. In this paper we introduce the model and state some useful properties. 相似文献
17.
随着高压电网结构的日益复杂,大小环网互相交错的情况屡见不鲜,这使得继电保护的整定计算越来越复杂,尤其是计算定值需要满足各种运行方式,而助增系数的计算结果受运行方式的影响极大,因而搜索极端运行方式是定值整定计算的重中之重。本文针对现有高压环网的特点,提出了一种基于回溯算法计算助增系数的方法,通过对保护支路的回溯搜索可得到不同级数的环网,全面考虑不同级数环网各种恶劣运行方式下的助增系数,并通过算例与传统助增系数计算方法的计算结果进行了对比,得出基于回溯算法能够快速准确地找到更为极端运行方式下的助增系数,最后通过实例电网验证了本文提出方法的有效性,并对本文提出方法的复杂度进行了分析,验证了本文提出方法的快速性。 相似文献