回溯(b a c k t r a c k i n g)是一種系統地搜索問題解答的方法。為了實現回溯,首先需要為問題定義一個解空間( solution space),這個空間必須至少包含問題的一個解(可能是最優的)。在迷宮老鼠問題中,我們可以定義一個包含從入口到出口的所有路徑的解空間;在具有n 個對象的0 / 1背包問題中(見1 . 4節和2 . 2節),解空間的一個合理選擇是2n 個長度為n 的0 / 1向量的集合,這個集合表示了將0或1分配給x的所有可能方法。當n= 3時,解空間為{ ( 0 , 0 , 0 ),( 0 , 1 , 0 ),( 0 , 0 , 1 ),( 1 , 0 , 0 ),( 0 , 1 , 1 ),( 1 , 0 , 1 ),( 1 , 1 , 0 ),( 1 , 1 , 1 ) }。
標簽:
搜索
上傳時間:
2014-01-17
上傳用戶:jhksyghr
C# BigInteger class. BigInteger.cs is a csharp program. It is the BIgInteger class. It has methods: abs() , FermatLittleTest(int confidence) ,gcd(BigInteger bi) , genCoPrime(int bits, Random rand) , genPseudoPrime(int bits, int confidence, Random rand) , genRandomBits(int bits, Random rand) , isProbablePrime(int confidence) , isProbablePrime() , Jacobi(BigInteger a, BigInteger b) , LucasSequence(BigInteger P, BigInteger Q, BigInteger k, BigInteger n) ,max(BigInteger bi) , min(BigInteger bi) , modInverse(BigInteger modulus) , RabinMillerTest(int confidence) ,
標簽:
BigInteger
class
BIgInteger
program
上傳時間:
2013-12-23
上傳用戶:ynzfm