Advertisement

回溯法用于解决装载问题的常数为3的上界函数

阅读量:

3. 上界函数的定义与特性

复制代码
 #include "stdafx.h"

    
 #include <iostream>
    
 #include <fstream>
    
 #include <string>
    
 using namespace std;
    
  
    
 // 上界函数
    
 template <class Type>
    
 class Loading
    
 {
    
     friend Type MaxLoading(Type[], Type, int); // 友元函数
    
 private:
    
     void Backtrack(int i);                            // 回溯函数
    
     int n;       // 集装箱数
    
     Type *w,     // 集装箱重量数组
    
     c,       // 第一艘轮船的在载重量
    
     cw,      // 当前载重量
    
     bestw,   // 当前最优装载重量
    
     r;       // 剩余集装箱重量
    
 };
    
  
    
 template <class Type>

全部评论 (0)

还没有任何评论哟~