poj 2420/1379 随机/模拟退火(求费马点/最偏离点)

模拟退火算法计算费马点 利用MATLAB编写模拟退火算法来实现计算安徽各市点的费马点问题。 立即下载

2420题意:给出平面中一些点,求平面中的一个点,使得这个点到其他所有点的距离之和最短(这个点叫作费马点),并输出这个距离和。

1379题意:背景和2420相同,只是求一个坐标到其他所有点的最短距离最大。

思路:先随机取个点,再取一个步长,朝4个方向走。如果新位置到各点距离比原来小,就走过去;直到当前位置比四周都好,此时缩小步长。如此迭代,直到步长小于题目的精度(这道题是0.1)输出即可。实际上缩小步长蕴含了模拟退火的思想。不过模拟退火中还可以按照一定概率留在原地(即使移动可以获得更好的效益值)。

朝四个方向走可以改为朝四周所有方向走,(http://www.2cto.com/kf/201409/334851.html)采用的是这种方法。

while(L > EPS) {
        double alpha = 2 * PI * Rand();//一个随机的角度
        Point temp(now.x + cos(alpha) * T,now.y + sin(alpha) * T);
        dE = Statistic(now) - Statistic(temp);
        if(dE >= 0 || exp(dE / L) > Rand)
            now = temp;
        L *= .99;
    }


2420代码:
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define N 105
struct point{
    double x,y;
}s[N],now,tmp;
int n;
int ori[4][2] = {{0,1},{0,-1},{1,0},{-1,0}};
double dd(struct point a,struct point b){
    return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));
}
double getdis(struct point now){
    int i;
    double res=0;
    for(i = 0;i<n;i++)
        res += dd(s[i],now);
    return res;
}
int main(){
    int i;
    double j,left,right,up,down,diff,dis;
    left = down = 10000;
    right = up = 0;
    scanf("%d",&n);
    for(i = 0;i<n;i++){
        scanf("%lf %lf",&s[i].x,&s[i].y);
        left = min(left,s[i].x);
        right = max(right, s[i].x);
        up = max(up, s[i].y);
        down = min(down, s[i].y);
    }
    now.x = (left+right)/2;//随机取个点,尽量往中间取
    now.y = (up+down)/2;
    diff = max(right-left,up-down) / 2;//取一个步长
    dis = getdis(now);
    while(diff > 0.1){
        for(i = 0;i<4;i++){
            tmp.x = now.x + ori[i][0]*diff;
            tmp.y = now.y + ori[i][1]*diff;
            if((j=getdis(tmp)) < dis){//如果四周优于当前点就走过去
                now = tmp;
                dis = j;
                break;
            }
        }
        if(i==4)//减小步长
            diff *= 0.5;
    }
    printf("%.0f\n",dis);
    return 0;
}

1379代码:

#include <cstdio>
#include <algorithm>
#include <cstring>
#include <ctime>
#include <cstdlib>
#define clr(s,t) memset(s,t,sizeof(s))
using namespace std;
#define INF 0x3fffffff
struct point{
    double x,y;
}p[1005],res,now,tmp;
int n,m,h,T;
int ori[4][2] = {{0,1},{1,0},{0,-1},{-1,0}};
int check(double x,double y){
    return x>=0 && y>=0 && x<=n && y<=m;
}
double dd(point a,point b){
    return (a.x-b.x)*(a.x-b.x) + (a.y-b.y)*(a.y-b.y);
}
int dist(point a){
    double res = 0x3fffffff;
    for(int i = 1;i<=h;i++)
        res = min(res,dd(a,p[i]));
    return res;
}
int cmp(point a,point b){
    if(a.x == b.x)
        return a.y < b.y;
    return a.x < b.x;
}
int eq(point a,point b){
    return a.x==b.x && a.y==b.y;
}
int main(){
    scanf("%d",&T);
    srand((unsigned int)time(0));
    while(T--){
        int i,j,k;
        double off;
        res.x = res.y = 0;
        scanf("%d %d %d",&n,&m,&h);
        for(i = 1;i<=h;i++)
            scanf("%lf %lf",&p[i].x,&p[i].y);
        sort(p+1, p+1+h, cmp);
        h = unique(p+1, p+1+h, eq)-p-1;
        for(k = 1;k<=20;k++){//多取几次初始点可以增大AC概率
            now.x = rand()%n;
            now.y = rand()%m;
            for(off = min(m,n);off>=0.001;){
                for(j = 0;j<4;j++){
                    tmp.x = now.x+ori[j][0]*off;
                    tmp.y = now.y+ori[j][1]*off;
                    if(check(tmp.x,tmp.y) && dist(tmp)>dist(now)){
                        now = tmp;
                        break;
                    }
                }
                if(j==4)
                    off /= 2;
            }
            if(dist(res) < dist(now))
                res = now;
        }
        printf("The safest point is (%.1lf, %.1lf).\n",res.x,res.y);
    }
    return 0;
}


手把手教你用Qt5打造二次元游戏启动器(附鸣潮同款UI源码) 本文详细介绍了如何使用Qt5框架从零开始构建一个功能完整、UI风格贴近《鸣潮》的二次元游戏启动器。教程涵盖无边框窗口、动态背景、自定义控件绘制、多线程资源加载以及下载管理等核心模块的实现,并提供了可运行的源码参考,帮助C++开发者和Qt爱好者深入掌握现代桌面应用开发技术。 阅读详情

相关推荐

PS/2鼠标接口协议

一、PS/2鼠标接口        PS/2接口用于许多现代的鼠标和键盘,由IBM最初开发和使用。物理上的PS/2接口有两种类型的连接器:5脚的DIN和6脚的MINI-DIN。        二、鼠标的接口协议原理             PS/2鼠标接口采用一种双向同步串行协议。即每在时钟线上发一个脉冲,就在数据线上发送一位数据。但是在相互传输中 ,主机是拥有总线控制权的

Ant's home 1万+

POJ2420爬山算法、模拟退火入门之n个定点的覆盖

A Star not a Tree?   Luke wants to upgrade his home computer network from 10mbs to 100mbs. His existing network uses 10base2 (coaxial) cables that allow you to connect any number of computers togeth...

c___c18的博客 506

【智能机器人开发全流程:硬件选型、软件架构与ROS实战,打造高效机器人系统】

通过模块化设计与ROS框架的灵活扩展,可快速搭建适应不同场景的机器人系统。实际开发中需重点关注。

dally2的博客 6034

爬山算法&模拟退火

优化算法入门系列文章目录(更新中):   1. 模拟退火算法   2. 遗传算法   一. 爬山算法 ( Hill Climbing )          介绍模拟退火前,先介绍爬山算法。爬山算法是一种简单的贪心搜索算法,该算法每次从当前解的临近解空间中选择一个最优解作为当前解,直到达到一个局部最优解。          爬山算法实现很简单,其主要缺点是会陷入局部最优解,而不一定能搜索

Lin_disguiser的博客 7640

【Python】多分类算法—Random Forest

【Python】多分类算法—Random Forest 本文将主要就Random Forest(随机森林)的多分类应用进行描述,当然也可运用于二分类中 文章目录【Python】多分类算法—Random Forest前言一、pandas是什么?二、使用步骤1.引入库2.读入数据总结 前言 本文主要引用的是sklearn 一、pandas是什么? 示例:pandas 是基于NumPy 的一种工具,该工具是为了解决数据分析任务而创建的。 二、使用步骤 1.引入库 代码如下(示例): import nump

weixin_43166884的博客 1万+

R语言灰色关联分析法

输入数据并用DT包的datatable函数展示数据 ABDDEF分别对应第1到第6个供应商产品质量、技术水平、供应能力、经济效益、交货情况、市场影响度指标属于效益型指 产品价格、地理位置、售后服务指标属于成本型指标。现分别对上述指标进行规范化: 对于效益型指标(正项指标)标准化公式为: x∗=x−min(x)max(x)−min(x) x^{\ast}=\frac{x-min\left( x \right)}{max\left( x \right) -min\left( x \right)} x∗=max

qq_54423921的博客 7995

JZOJ 5267. 费马点问题

JZOJ 5267. 费马点问题 Description给n个点,每个点的横纵坐标为[0,10000]内的整数,找出一个点,使这个点到其他所有点的距离之和最小,也就是求费马点。 找到的点可能是小数。Input第一行一个整数n表示点数,后面n行每行两个整数,表示点的坐标。Output第一行一个整数n表示点数,后面n行每行两个整数,表示点的坐标。 8 8 8 6 5 7Sampl

Felix-Lee的博客 2003

4G LTE 与 5G 无线网络规划对比:从 BBU/RRU 到 CU/DU/AAU 的架构演进解析

本文深度解析4G LTE与5G无线网络架构的演进差异,从BBU/RRU分立式架构到CU/DU/AAU三级重构,揭示移动通信代际跃迁的技术本质。重点对比了网络规划中的覆盖能力、容量规划、传输网络等九大维度,为通信工程师提供实用的技术对照手册,助力5G网络高效部署。

weixin_32821533的博客 287

模拟退火(ACdreamer)

周日的中南多校考了道最小包含多边形的退火题,那就向yddalao学习,学学退火。 模拟退火算法是用来求解最优化问题的算法。比如著名的TSP问题,函数最大值最小值问题等等。接下来将以如下几个方面来详细介绍模拟退火算法。 Contents 模拟退火算法认识 模拟退火算法描述 费马点问题求解 最小包含球问题求解 函数最值问题求解 TSP问题求解 模拟退火算法认识 爬山算法也是...

tomjobs的博客 1028

飞书接入OpenClaw:从零到一的保姆级图文教程

本文主要介绍了飞书接入OpenClaw:从零到一的保姆级图文教程,希望能对学习使用OpenClaw 的同学们有所帮助。 文章目录 1. 背景 2. 解决方案 2.1 步骤一:安装插件 2.2 步骤二:创建机器人应用 2.3 步骤三:测试 3. 注意事项

weixin_43178406的博客 13万+

《QGIS快速入门与应用基础》209:重叠标注处理(移除/偏移)

系统讲解了QGIS中处理标注重叠问题的核心方法与实操流程。文章首先阐述了重叠标注处理的底层逻辑,即 先预防、再调整、后兜底 的递进式策略,并详细介绍了设置入口与界面布局。重点讲解了偏移处理这一首选方案,包括基础方向设置、最大偏移距离与步长配置、以及自动换行等进阶优化规则。针对不同要素类型(点、线、面)提供了行业规范的偏移方向设置建议,并给出从稀疏到密集场景的完整参数推荐值。最后以城市POI点图层为例,演示了5步偏移设置流程,帮助用户实现 无重叠、无压盖、重点突出 的专业标注效果。

LuckyHanMo的博客 668

POJ 2420 A Star not a Tree?(模拟退火)

A Star not a Tree? Luke wants to upgrade his home computer network from 10mbs to 100mbs. His existing network uses 10base2 (coaxial) cables that allow you to connect any number of computers together i...

Tan_JX 273

【数据分析八步法】将模糊需求转化为可验证的分析问题

国内访问Huggingface官方源常遇网络问题,可通过切换国内镜像提升下载速度。三种配置方式:1)设置HF_ENDPOINT环境变量;2)在from_pretrained中直接指定镜像参数;3)修改本地Huggingface配置文件。常用镜像包括hf-mirror.com、阿里云ModelScope和清华镜像源。注意镜像同步延迟、私有模型限制,建议配合huggingface-cli工具使用,必要时取消代理设置。合理配置镜像源可显著改善Huggingface生态使用体验。

Mr数据杨 857

模拟退火(D Country Meow,POJ 2420,POJ 1379)

D Country Meow 最小球覆盖模板题,模拟退火算法 题意: 给定空间内 N 个点,求某个点到 N 个点的距离最大值的最小值 代码(含详细注释): #include<bits/stdc++.h> #define LL long long using namespace std; const int INF=0x3f3f3f3f; const int M=150; const double eps=1e-3; //精度 //模拟退火有一个初始温度,温度越高,接受较差的解的可能

人工智能方向,计算机视觉(https://github.com/chenshunpeng) 378

android 蓝牙通讯demo

android 下蓝牙通讯demo,实现了发现蓝牙,使能蓝牙,通过蓝牙发送消息。

文档:亲测可用解决vnc灰屏,黑屏,鼠标大黑叉情况

主要解决vnc-viewer灰屏,黑屏,鼠标大黑叉等现象,详细见文档。

POJ 1379 Run away & POJ 2420 A star not a Tree [模拟退火] [爬山算法]

Run Away Time Limit: 3000MS Memory Limit: 65536KB 64bit IO Format: %lld & %lluDescription One of the traps we will encounter in the Pyramid is located in the Large Room. A lot of small hol

C'est la vie. 791

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

POJ 1379 模拟退火

Run Away Time Limit:3000MS Memory Limit:65536K Total Submissions:10634 Accepted:3177 Description One of the traps we will encounter in the Pyramid is located i...

ba82586628365094的博客 184

廖雪峰Python教程[完整版]

廖雪峰的python教程整理的,已经排好版了,而且还是完整的,适合小白

模拟退火(Simulated Annealing)算法 PO J1379 2420

在很多信息学竞赛选手看来,很多时候几何题目就是代码量大的代名词,即使对于一些经典问题,庞大的代码量也使很多人望而却步。模拟退火算法思维及编写简单、灵活,可以在一类最远、最近或第k近距离问题中发挥威力。模拟退火算法介绍1.1模拟退火算法的原理模拟退火算法是一种元启发式(Meta-Heuristics)算法,来源于固体退火原理,将固体加热至充分高的温度,再让其徐徐冷却。加热时,固体内部粒子随温升变为无序状,内能增大,而徐徐冷却时粒子渐趋有序,在每个温度都达到平衡态,最后在常温时达到基态,内能减为最小。根据Met

魔神翼 2423

poj 2420 & poj1379 模拟退火

具体模拟退火的原理可参考  http://www.cnblogs.com/heaad/archive/2010/12/20/1911614.html 模拟退火可用于一些  精度  要求不是很高的题目。 比如取答案的0.1,或者没有小数点 poj2420: /* 题意:给定n个点和范围(0,0)--(x,y),在范围内找到一个点,使得n个点到这个点的最小距离最大 模拟退火法 模拟退火的过程

wishcxz_acm 563

poj 2420 模拟退火法基础

/* 题意:给n个电脑,求一个点到这n个电脑的距离和最小。 模拟退火法:和poj1379的方法类似 因为坐标范围是0-10000 不妨把它看成是10000*10000的正方形来做 */ #include #include #include #include #define inf 10000000000000 using namespace std; #define N 110 #define

晴朗的博客 702

poj2420A Star not a Tree?【模拟退火】

Language: Default A Star not a Tree? Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 4664   Accepted: 2276 Description Luke wants to upgrade his home com

走一步再走一步 1040

大数据采集方案选型指南:从日志到数据库同步的实战框架

数据采集是大数据平台建设的基石,无论日志采集还是数据库同步,都需在吞吐、时延、一致性之间权衡。从Filebeat、Logstash到Canal、Debezium、Flink CDC,再到DataX、SeaTunnel,不同工具对应不同场景:日志采集侧重高吞吐低资源占用,数据库增量同步关注CDC与断点续传,离线批量则强调高吞吐与幂等。理解各类方案的原理和边界,才能避免选型陷阱。本文基于真实工程实践,系统拆解选型前需明确的量化指标、方案矩阵对比,以及四步落地的选型流程,为大数据平台建设提供可复用的判断框架。

weixin_34221036的博客 281

模拟退火+爬山算法

爬山算法:兔子朝着比现在高的地方跳去。它找到了不远处的最高山峰。但是这座山不一定是珠穆朗玛峰。这就是爬山算法,它不能保证局部最优值就是全局最优值。 模拟退火:兔子喝醉了。它随机地跳了很长时间。这期间,它可能走向高处,也可能踏入平地。但是,它渐渐清醒了并朝最高方向跳去。这就是模拟退火。

c___c18的博客 531

poj-2420 A Star not a Tree?(模拟退火算法)

题目链接: A Star not a Tree? Time Limit:1000MS Memory Limit:65536K Total Submissions:5219 Accepted:2491 Description Luke wants to upgrade his home computer network ...

weixin_30381793的博客 90
上一篇: poj 2454 随机化(划片使得选举胜利)
下一篇: poj 1980 dfs+剪枝(Unit Fraction Partition)
dumeichen
博客等级 码龄13年 55粉丝 475原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值