// 17x2.cpp : Defines the entry point for the console application.//#include "stdafx.h"// 分支界定法:最大装载问题,改进版(使用FIFO)#include<iostream.h>#include "lqueue.h"template<class T>T GetMaxLoading(T w[], T c, int n){ LinkedQueue<T> Q; // 为第一层初始化 Q.Add(-1); int i = 1; T Ew Read More
posted @ 2012-02-11 06:14 findumars Views(496) Comments(0) Diggs(0) Edit
// 17x1.cpp : Defines the entry point for the console application.//#include "stdafx.h"// 分支界定法:最大装载问题(使用FIFO)#include <iostream.h>#include "lqueue.h"// 所有参数里,最重要的是当前路径的累计权重wt,其余都是辅助参数template<class T>void AddLiveNode(LinkedQueue<T> &Q, T wt, T& bestw, i Read More
posted @ 2012-02-11 04:41 findumars Views(1103) Comments(0) Diggs(0) Edit
// 16x5.cpp : Defines the entry point for the console application.//#include "stdafx.h"// 回溯法:0/1背包问题(利用价值密度进行优化)// 左孩子的界限函数的价值与父节点相同,因为总价值=cp+子树价值。当向左孩子移的时候,那部分价值已经计入了新的cp了。#include <iostream.h>#include "msort.h"#include "object.h" // 内含两部分数据:物品标识,物品价值密度template& Read More
posted @ 2012-02-11 00:18 findumars Views(967) Comments(0) Diggs(0) Edit
unit DateUtils;interfaceuses SysUtils, Math, Types;// 把完整时间分解成日期和时间两部分function DateOf(const AValue: TDateTime): TDateTime;function TimeOf(const AValu... Read More
posted @ 2012-02-10 05:22 findumars Views(28136) Comments(0) Diggs(0) Edit
// 16x3.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include<iostream.h>template<class T>class Loading { friend GetMaxLoading(T [], T, int, int []); private: void Compute(int i); int n, *x, // 当前取值 *bestx; // 目前的最佳方案 ... Read More
posted @ 2012-02-10 03:46 findumars Views(862) Comments(0) Diggs(0) Edit