运筹学学习(P,NP,NP-Comlete,NP-Hard问题)

1.如果一个问题可以找到一个能在多项式的时间里解决它的算法,那么这个问题就属于P问题

2.NP问题是指可以在多项式的时间里验证一个解的问题。NP问题的另一个定义是:可以在多项式的时间里猜出一个解的问题。

很显然,所有的P类问题都是NP问题。也就是说,能多项式地解决一个问题,必然能多项式地验证一个问题的解——既然正解都出来了,验证任意给定的解也只需要比较一下就可以了。

3.NPC问题:为了说明NPC问题,我们先说一下约化(归约)。一个问题A可以约化为问题B的含义即是,可以用问题B的解决方法来解决问题A。问题A可以“变成”问题B。B的时间复杂度高于或等于问题A的时间复杂度。

NPC问题的定义:

首先,它得是一个NP问题。然后,所有的NP问题都可以约化到它。

同时满足这两个条件的问题就是NPC问题。

NPC问题的证明:(证明A问题是NPC问题的方法)

(1)证明A是NP问题

(2)选择一个已知的NPC问题A'

(3)构建转换过程f使得A'转换为A

(4)证明f是多项式的

NPC问题:

团问题,顶点覆盖问题,哈密顿回路问题,旅行商问题,子集和问题

4.NP-Hard问题:首先,所有的NPC问题都是属于NP-Hard的。其次,如果一个问题不知道其是否属于NP,但是我们知道有某个NPC问题可以被多项式转化为该问题,则该问题属于NP-Hard。

NP-Hard证明:(证明A是NP-Hard问题)

(1)选择一个已知的NPC问题A'

(2)构建转换过程f使得A'转换为A

(3)证明f是多项式的转换

5.它们之间的关系:

 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
C++ RTMP Server Instructions how to compile and use C++ RTMP Server (a.k.a crtmpserver) Requirements: * GCC and other C++ tools * SVN * libdl, libssl, libcrypto (make sure you have the "devel" packages of libdl, ssl and crypto installed prior to compiling) In order to get the source code, issue the following command: svn co --username anonymous https://svn.rtmpd.com/crtmpserver/trunk crtmpserver When it asks for password, hit Enter key Compile the package. Do the following steps: cd crtmpserver/builders/cmake cmake . (this step will create all the Makefile's that are required. If some package is missing, the cmake will complain) make The compilation procedure should be finished within few minutes. After you compiled the package, it's time to test it. Run the following command: ./crtmpserver/crtmpserver crtmpserver/crtmpserver.lua If everything goes well, you'll get on your console a table with IP's, ports, protocols, and application names If you see this table, then crtmpserver is working. Lets test it the server. Follow these simple steps: * Download a simple FLV or MP4 file. You can dowload a sample file from here: http://www.mediacollege.com/adobe/flash/video/tutorial/example-flv.html * Place the file you downloaded into the crtmpserver/media folder * Download an FLV player. For this example, we'll use JW Player. Get it here: http://www.longtailvideo.com/players/jw-flv-player * Extract the JW Player to a directory which is accessible through your web server * Go to the extracted directory and create an HTML file which will include the player and play the file. Here's an example: <html> <body> <script type='text/javascript' src='swfobject.js'></script> <div id='mediaspace'>This text will be replaced</div> <script type='text/javascript'> var so = new SWFObject('player.swf','mpl','640','360','9'); so.addParam('allowfullscreen','true'); so.addParam('allowscriptaccess','always'); so.addParam('wmode','opaque'); so.addVariable('file','file-download'); so.addVariable('streamer','rtmp://127.0.0.1/flvplayback/'); so.write('mediaspace'); </script> </body> </html> * Change the 127.0.0.1 to either the IP of your crtmpserver or simply use a hostname of your machine * Replace file-download with the actual filename of your sample you download. Remeber to omit the .flv if it's an FLV file * Open a web browser and point it to to the web server IP/Hostname and the directory you installed the player (example: http://127.0.0.1/player) * You should see a player. Click the play button and the video should be played. If you see the video, then everything works well. Installing crtmpserver: * Go to the directory crtmpserver/cmake * Run the following command: cmake -DCRTMPSERVER_INSTALL_PREFIX=<path> (for example /usr/local/crtmpserver) * After previous command done start build project with command: make * After build comlete run command: make install * After install you has installed crtmpserver in <path>(in our case /usr/local/crtmpserver) * Now you can start crtmpserver with command: sudo <path>/sbin/crtmpserver --uid=<UID> <path>/etc/crtmpserver.lua in our case: sudo /usr/local/crtmpserver/sbin/crtmpserver --uid=<UID> /usr/local/crtmpserver/etc/crtmpserver.lua Also look into builders/packing directory. There are several OS specific builders. * in directory "debian" builder for Debian, also can be used for Ubuntu and other distributions based on debian * in directory "freebsd" builder(port) for FreeBSD crtmpserver settings * All crtmpserver settings are located in a detailed file calle: crtmpserver.lua

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值