simanTSP.cxx File Reference

#include <cmath>
#include <vector>
#include <algorithm>
#include "Math/GSLSimAnnealing.h"
#include "Math/GSLRndmEngines.h"
#include "Math/SMatrix.h"
#include "Math/Math.h"
#include "TH1.h"
#include "TGraph.h"
#include "TCanvas.h"
#include "TApplication.h"

Go to the source code of this file.

Classes

struct  s_tsp_city
class  MySimAnFunc

Defines

#define N_CITIES   (sizeof(cities)/sizeof(Stsp_city))

Typedefs

typedef s_tsp_city Stsp_city

Functions

double city_distance (Stsp_city c1, Stsp_city c2)
void print_distance_matrix ()
void simanTSP (bool debug=true)
void do_all_perms (MySimAnFunc &f, int offset)
void FullSearch ()
int main (int argc, char **argv)

Variables

bool showGraphics = true
Stsp_city cities []
double distance_matrix [N_CITIES][N_CITIES]
unsigned int r1 [N_CITIES]
unsigned int r2 [N_CITIES]
unsigned int r3 [N_CITIES]
unsigned int nfiter = 0
double best_E
double second_E
double third_E


Define Documentation

#define N_CITIES   (sizeof(cities)/sizeof(Stsp_city))

Definition at line 53 of file simanTSP.cxx.

Referenced by MySimAnFunc::calculate_distance_matrix(), MySimAnFunc::Distance(), do_all_perms(), MySimAnFunc::Energy(), MySimAnFunc::FastCopy(), FullSearch(), MySimAnFunc::MySimAnFunc(), MySimAnFunc::Print(), print_distance_matrix(), MySimAnFunc::PrintRoute(), MySimAnFunc::SetRoute(), simanTSP(), and MySimAnFunc::Step().


Typedef Documentation

typedef struct s_tsp_city Stsp_city

Definition at line 38 of file simanTSP.cxx.


Function Documentation

double city_distance ( Stsp_city  c1,
Stsp_city  c2 
)

Definition at line 58 of file simanTSP.cxx.

References acos(), c1, cos(), s_tsp_city::lat, s_tsp_city::longitude, M_PI, sin(), x1, and x2.

Referenced by MySimAnFunc::calculate_distance_matrix().

void do_all_perms ( MySimAnFunc f,
int  offset 
)

Definition at line 329 of file simanTSP.cxx.

References best_E, copy(), E, N_CITIES, nfiter, r1, r2, r3, second_E, and third_E.

Referenced by FullSearch().

void FullSearch (  ) 

Definition at line 406 of file simanTSP.cxx.

References best_E, copy(), do_all_perms(), dummy, N_CITIES, nfiter, r1, r2, r3, second_E, and third_E.

int main ( int  argc,
char **  argv 
)

Definition at line 448 of file simanTSP.cxx.

References TApplication::Run(), showGraphics, and simanTSP().

void print_distance_matrix (  ) 

Definition at line 85 of file simanTSP.cxx.

References distance_matrix, i, j, and N_CITIES.

void simanTSP ( bool  debug = true  ) 

Definition at line 244 of file simanTSP.cxx.

References c1, TCanvas::cd(), cities, debug, TPad::Divide(), TGraph::Draw(), TH1::Draw(), h1, i, s_tsp_city::lat, s_tsp_city::longitude, N_CITIES, p, ROOT::Math::GSLSimAnnealing::Params(), TH2D::SetBinContent(), TAttMarker::SetMarkerStyle(), showGraphics, ROOT::Math::GSLSimAnnealing::Solve(), x0, xmin, and ymin.

Referenced by main().


Variable Documentation

double best_E

Definition at line 325 of file simanTSP.cxx.

Referenced by do_all_perms(), and FullSearch().

Stsp_city cities[]

Initial value:

 {{"Santa Fe",    35.68,   105.95},
                      {"Phoenix",     33.54,   112.07},
                      {"Albuquerque", 35.12,   106.62},
                      {"Clovis",      34.41,   103.20},
                      {"Durango",     37.29,   107.87},
                      {"Dallas",      32.79,    96.77},
                      {"Tesuque",     35.77,   105.92},
                      {"Grants",      35.15,   107.84},
                      {"Los Alamos",  35.89,   106.28},
                      {"Las Cruces",  32.34,   106.76},
                      {"Cortez",      37.35,   108.58},
                      {"Gallup",      35.52,   108.74}}

Definition at line 40 of file simanTSP.cxx.

Referenced by MySimAnFunc::calculate_distance_matrix(), MySimAnFunc::PrintRoute(), and simanTSP().

double distance_matrix[N_CITIES][N_CITIES]

Definition at line 55 of file simanTSP.cxx.

Referenced by print_distance_matrix().

unsigned int nfiter = 0

Definition at line 324 of file simanTSP.cxx.

Referenced by do_all_perms(), and FullSearch().

unsigned int r1[N_CITIES]

Definition at line 321 of file simanTSP.cxx.

Referenced by TLatex::Analyse(), TGLSelectRecord::AreSameSelectionWise(), TSpectrum2::Background(), TSpectrum3::Background(), ClassImp(), create_circ(), PC3::createkey(), TDecompBK::Decompose(), TSpectrum2Fit::Deramp2(), TSpectrum2Fit::Derampx(), TSpectrumFit::Derb(), TSpectrum2Fit::Derbx(), TSpectrum2Fit::Derby(), TSpectrumFit::Derderi0(), TSpectrum2Fit::Derderi01(), TSpectrum2Fit::Derderi02(), TSpectrum2Fit::Derderj02(), TSpectrumFit::Derdersigma(), TSpectrum2Fit::Derdersigmax(), TSpectrum2Fit::Derdersigmay(), TSpectrumFit::Deri0(), TSpectrum2Fit::Deri01(), TSpectrum2Fit::Deri02(), TSpectrum2Fit::Derj02(), TSpectrumFit::Ders(), TSpectrumFit::Dersigma(), TSpectrum2Fit::Dersigmax(), TSpectrum2Fit::Dersigmay(), TSpectrum2Fit::Dersx(), TSpectrum2Fit::Dersxy(), TSpectrum2Fit::Dersy(), TSpectrumFit::Dert(), TSpectrum2Fit::Dertx(), TSpectrum2Fit::Dertxy(), TSpectrum2Fit::Derty(), ROOT::Math::Distance(), TCrown::DistancetoPrimitive(), TEllipse::DistancetoPrimitive(), TGeoSphere::DistFromInside(), TGeoSphere::DistFromOutside(), do_all_perms(), TCreatePrimitives::Ellipse(), RooBukinPdf::evaluate(), TEllipse::ExecuteEvent(), TCurlyArc::ExecuteEvent(), RooAddPdf::expectedEvents(), TGeoShape::FillBuffer3D(), TH1::FillRandom(), TH2::FillRandom(), TH3::FillRandom(), FullSearch(), Roo2DKeysPdf::g(), g2(), gdk_rgb_convert_truecolor_lsb_d(), gdk_rgb_convert_truecolor_msb_d(), generate_random(), TF1::GetQuantiles(), TH1::GetRandom(), TF1::GetRandom(), TH2::GetRandom2(), TH3::GetRandom3(), gsl_poly_complex_solve_cubic(), main(), TEveCalo2DGL::MakeRhoZCell(), TEveCalo2DGL::MakeRPhiCell(), makeTree_circ(), TGWin32::MapRaised(), ROOT::Math::operator *(), operator!=(), ROOT::Minuit2::GaussRandomGen::operator()(), operator==(), TView3D::PadRange(), TGraph2DPainter::PaintTriangles(), parallelcoord(), PC3::pc3init(), piRandom(), TUnfoldSys::PrepareUncorrEmat(), TimeReport::print(), regexp(), TEveCalo3DGL::RenderBarrelCell(), TEveCalo3DGL::RenderGridEndCap(), rf604_constraints(), TGeoPgon::Rpg(), TSpectrum3::SearchFast(), TSpectrum3::SearchHighRes(), TSpectrumFit::Shape(), TSpectrum2Fit::Shape2(), test17(), test_smatrix_op(), test_smatrix_sym_op(), test_tmatrix_op(), test_tmatrix_sym_op(), testAll(), TestBasic604::testCode(), testIO(), TestLorentzVector(), testRotation(), testRotations3D(), TestVector3(), testVectorIO(), unuranSimple(), RooAddPdf::updateCoefficients(), RooAddModel::updateCoefficients(), and TMath::Voigt().

unsigned int r2[N_CITIES]

Definition at line 322 of file simanTSP.cxx.

Referenced by TGLSelectRecord::AreSameSelectionWise(), TSpectrum2::Background(), TSpectrum3::Background(), TSpline5::BuildCoeff(), ClassImp(), TGeoSphere::ComputeNormal(), TGeoSphere::Contains(), TGeoHype::Contains(), TGeoEltu::Contains(), TGeoCone::Contains(), TGeoCtub::Contains(), TGeoTube::Contains(), TGeoPcon::Contains(), create_circ(), TSpectrumFit::Derderi0(), TSpectrumFit::Derdersigma(), TSpectrumFit::Deri0(), TSpectrumFit::Dersigma(), TSpider::DistancetoPrimitive(), TCrown::DistancetoPrimitive(), TEllipse::DistancetoPrimitive(), TGeoSphere::DistFromInside(), TGeoCtub::DistFromOutside(), TGeoPgon::DistFromOutside(), TGeoPcon::DistFromOutside(), TGeoHype::DistFromOutside(), TGeoSphere::DistFromOutside(), TGeoConeSeg::DistFromOutsideS(), TGeoTube::DistFromOutsideS(), TGeoTubeSeg::DistFromOutsideS(), TGeoCone::DistFromOutsideS(), TGeoSphere::DistToSphere(), do_all_perms(), TCreatePrimitives::Ellipse(), RooBukinPdf::evaluate(), TEllipse::ExecuteEvent(), RooAddPdf::expectedEvents(), TGeoShape::FillBuffer3D(), FullSearch(), Roo2DKeysPdf::g(), g2(), generate_random(), ROOT::Fit::FitResult::GetConfidenceIntervals(), TF1::GetQuantiles(), TF1::GetRandom(), gsl_poly_complex_solve_cubic(), TColorWheel::InCircles(), TGeoSphere::IsOnBoundary(), TGeoSphere::IsPointInside(), main(), TEveCalo2DGL::MakeRhoZCell(), TEveCalo2DGL::MakeRPhiCell(), makeTree_circ(), TGWin32::MapRaised(), ROOT::Math::operator *(), operator!=(), ROOT::Minuit2::GaussRandomGen::operator()(), operator==(), TView3D::PadRange(), parallelcoord(), piRandom(), TUnfoldSys::PrepareUncorrEmat(), TimeReport::print(), THistPainter::ProjectAitoff2xy(), ROOT::Math::AxisAngle::Rectify(), TEveCalo3DGL::RenderBarrelCell(), TEveCalo3DGL::RenderGridEndCap(), rf604_constraints(), rotate(), TGeoPgon::Rpg(), TGeoSphere::Safety(), TSpectrum3::SearchFast(), TSpectrum3::SearchHighRes(), TGeoEltu::SetPoints(), TSpectrumFit::Shape(), TRandom::Sphere(), test17(), test_smatrix_op(), test_tmatrix_op(), testAll(), TestBasic604::testCode(), TestBasic601::testCode(), testIntegration(), testIO(), TestLorentzVector(), testRotation(), testRotations3D(), TestVector3(), unuranSimple(), RooAddPdf::updateCoefficients(), and RooAddModel::updateCoefficients().

unsigned int r3[N_CITIES]

Definition at line 323 of file simanTSP.cxx.

Referenced by TSpectrum3::Background(), ClassImp(), create_circ(), TSpectrumFit::Derderi0(), TSpectrumFit::Derdersigma(), TSpectrumFit::Deri0(), TSpectrumFit::Dersigma(), do_all_perms(), RooBukinPdf::evaluate(), FullSearch(), generate_random(), TF1::GetRandom(), main(), makeTree_circ(), TGWin32::MapRaised(), ROOT::Math::operator *(), TView3D::PadRange(), parallelcoord(), piRandom(), TUnfoldSys::PrepareUncorrEmat(), rf604_constraints(), TSpectrum3::SearchFast(), TSpectrum3::SearchHighRes(), TRandom2::SetSeed(), TRandom1::SetSeed2(), TSpectrumFit::Shape(), testAll(), TestBasic604::testCode(), testIntegration(), testIO(), TestLorentzVector(), testRotation(), and TestVector3().

double second_E

Definition at line 325 of file simanTSP.cxx.

Referenced by do_all_perms(), and FullSearch().

bool showGraphics = true

Definition at line 27 of file simanTSP.cxx.

double third_E

Definition at line 325 of file simanTSP.cxx.

Referenced by do_all_perms(), and FullSearch().


Generated on Tue Jul 5 16:07:15 2011 for ROOT_528-00b_version by  doxygen 1.5.1