np-hard

Java: Traveling Salesman - Found polynomial algorithm

非 Y 不嫁゛ 提交于 2019-12-04 22:11:28
Edit : An improvement to this algorithm been found. Your are welcome to see it. This question is the an improvement of my old question. Now I want to show you Java code sample , and explain my algorithm in more details. I think that I found a polynomial algorithm to get an exact solution to the Traveling Salesman Problem. My implementation is build from 5 steps: 1) Quick setup 2) Search for solution 3) Stop condition 1 4) Stop condition 2 5) Stop condition 3 I want to start from step 2 and 3, and if I do not get wrong there I will show you the rest of it. So what I am going to show you now, is

NP-Complete VS NP-Hard

 ̄綄美尐妖づ 提交于 2019-12-04 14:23:54
I am trying to understand the difference between NP-Complete and NP-Hard. Below is my understanding An NP-Hard problem is one that is not solvable in polynomial time but can be verified in polynomial time. An NP-Complete problem is one that is in NP and is also NP-Hard. Is the above definition correct? If so, What about problems not In NP but NP-Hard. Wouldn't they be harder than NP-Complete problem, say they can only be solved and verified in exponential time? A NP problem (not NP-Hard problem) is a decision problem which can be verified in polynomial time. Maybe they are solvable in

Teacher time schedule algorithm

╄→尐↘猪︶ㄣ 提交于 2019-12-04 07:29:27
问题 This is a problem I've had on my mind for a long time. Being the son of a teacher and a programmer, it occurred to me early on... but I still haven't found a solution for it. So this is the problem. One needs to create a time schedule for a school, using some constraints. These are generally divided in two categories: Sanity Checks A teacher cannot teach two classes at the same time A student cannot follow two lessons at the same time Some teachers must have at least one day off during the

Relationship between NP-hard and undecidable problems

a 夏天 提交于 2019-12-03 11:59:51
Am a bit confused about the relationship between undecidable problems and NP hard problems. Whether NP hard problems are a subset of undecidable problems, or are they just the same and equal, or is it that they are not comparable? For me, I have been arguing with my friends that undecidable problems are a superset to the NP hard problems. There would exist some problems that are not in NP hard but are undecidable. But i am finding this argument to be weak and am confused a bit. Are there NP-complete problems that are undecidable.? is there any problem in NP hard which is decidable.?? Some

largest possible rectangle of letters

那年仲夏 提交于 2019-12-03 05:13:57
问题 Write a program to find the largest possible rectangle of letters such that every row forms a word (left to right) and every column forms a word (top to bottom). I found this interesting question. It's not homework, though it may sound as such. (I'm not in school). I'm doing this for fun. Example From cat , car , ape , api , rep , tip we get the following rectangle (which is a square): c a r a p e t i p My initial idea is to build a some sort of a prefix tree so I can retrieve all words that

简析 NP 问题 和P问题

丶灬走出姿态 提交于 2019-12-02 18:05:08
简析 NP 问题 和P问题 最简单的解释: P:算起来很快的问题 NP:算起来不一定快,但对于任何答案我们都可以快速的验证这个答案对不对 NP-hard:比所有的NP问题都难的问题 NP-complete:满足两点: 是NP hard的问题 是NP问题 严谨的定义: 问题: ​ 对于一个包含由0和1组成的字符串集合S,以某个01字符串x作为输入,要求某个图灵机判断x在不在S里面。这里的图灵机可以先想象成平时我们用的计算机,S也可以被看成我们要解决的问题。注意我们的问题非常简单,就是要判断某个字符串x是否在某个集合S里面,下面是定义: P:有一个图灵机在多项式时间内能够判断x是否在S里面 NP:有一个图灵机M,如果某个字符串x在S里面,那么存在一个验证字符串u(注意这个u是针对这个x的,而且长度必须是x长度的多项式 关系),M以x和u作为输入,能够验证x真的是在S里面。 NP-hard:如果某个问题S是NP-hard,那么对于任意一个NP问题,我们都可以把这个NP问题在多项式时间之内转化为S,并且原问题的答案和转化后S的答案是相同的。也就是说只要我们解决了S,那么就解决了所有的NP问题。 NP-complete:一个问题既是NP-hard,又在NP里面;也就是说 解决了这个问题我们就解决了所有NP问题 这个问题本身也是个NP问题 好,下面先来解释为什么会有人搞出来这么莫名其妙的定义

Teacher time schedule algorithm

安稳与你 提交于 2019-12-02 14:10:41
This is a problem I've had on my mind for a long time. Being the son of a teacher and a programmer, it occurred to me early on... but I still haven't found a solution for it. So this is the problem. One needs to create a time schedule for a school, using some constraints. These are generally divided in two categories: Sanity Checks A teacher cannot teach two classes at the same time A student cannot follow two lessons at the same time Some teachers must have at least one day off during the week All the days of the week should be covered by the time table Subject X must have exactly so-and-so

Algorithm lesson final exam

走远了吗. 提交于 2019-11-28 16:27:23
1、algorithm analysis O B/W/AV/AMOR,混入其他问题,设计+分析 2、传统算法(肯定要考) 1)divide and conquer master therem、 recursive tree、分析复杂度、递归树加起来得到最终结果 2)greedy algorithm example sort->select 拟阵 独立系统的贪心模板,直接得到近似比 3)dynamic programming sub-optimal structrue、编辑距离 3、graph algorithm 1)exproration bfs and dfs、最小生成树 2)最短路,single path all pair 负环、负边 3)max-flow 优化方式 4、turing machine Np/NPC NP-hard np-reduction 5、approximation greedy/sequential/local search/lp rouding 三种算法的设计、图算法、图灵机、近似算法 来源: https://www.cnblogs.com/elpsycongroo/p/11939165.html

What is the problem name for Traveling salesman problem(TSP) without considering going back to starting point?

拜拜、爱过 提交于 2019-11-27 19:20:09
I would like to know what is the problem name for TSP w/o considering the way of going back to starting point and what is the algorithm to solve this. I looked into Shortest path problem but that is not what I am looking for, the problem only find the shortest path from 2 assigned points. But what I am looking for is the problem which we give n points and inputting only 1 starting point. Then, find the shortest path traveling all points exactly once. (end point can be any point.) I also looked into Hamiltonian path problem but it seems not to solve my defined problem but rather find whether

3 dimensional bin packing algorithms

萝らか妹 提交于 2019-11-27 17:20:59
I'm faced with a 3 dimensional bin packing problem and am currently conducting some preliminary research as to which algorithms/heuristics are currently yielding the best results. Since the problem is NP hard I do not expect to find the optimal solution in every case, but I was wondering: 1) what are the best exact solvers? Branch and Bound? What problem instance sizes can I expect to solve with reasonable computing resources? 2) what are the best heuristic solvers? 3) What off-the-shelf solutions exist to conduct some experiments with? As far as off the shelf solutions, check out MAXLOADPRO