#include "StdAfx.h"
//源代码:
#include <stdio.h>
#include <malloc.h>
#include <stdlib.h>
#include <time.h>
#include <omp.h>
#define NoEdge 1000
struct MinHeapNode
{
int lcost; //子树费用的下界
int cc; //当前费用
int rcost; //x[s:n-1]中顶点最小出边费用和
int s; //根节点到当前节点的路径为x[0:s]
int *x; //需要进一步搜索的顶点是//x[s+1:n-1]
struct MinHeapNode *next;
};
int n; //图G的顶点数
int **a; //图G的邻接矩阵
//int NoEdge; //图G的无边标记
int cc; //当前费用
int bestc; //当前最小费用
MinHeapNode* head = 0; /*堆头*/
MinHeapNode* lq = 0; /*堆第一个元素*/
MinHeapNode* fq = 0; /*堆最后一个元素*/
clock_t start, finish;
double duration;
int DeleteMin(MinHeapNode*&E)
{
MinHeapNode* tmp = NULL;
tmp = fq;
// w = fq->weight ;
E = fq;
if(E == NULL)
return 0;
head->next = fq->next; /*一定不能丢了链表头*/
fq = fq->next;
// free(tmp) ;
return 0;
}
int Insert(MinHeapNode* hn)
{
if(head->next == NULL)
{
head->next
采用openMP并行方法,实现用分支界限法解决的旅行售货员问题
最新推荐文章于 2024-05-26 14:29:31 发布