Class: SA_Analysis

Inherits:
Object
  • Object
show all
Defined in:
lib/flukso/plots.rb

Instance Method Summary collapse

Constructor Details

#initialize(path, datafile, loadlevel) ⇒ SA_Analysis

Returns a new instance of SA_Analysis.



434
435
436
437
438
439
440
# File 'lib/flukso/plots.rb', line 434

def initialize(path, datafile, loadlevel)
  @workingdir=path
  @datafile = File.expand_path(File.join(path, datafile))
  @loadlevel = loadlevel
  puts "Using data from file #{@datafile}" if $verbose
  @runner = RRunner.new(path)
end

Instance Method Details

#plotSingleRunObject



441
442
443
444
445
446
# File 'lib/flukso/plots.rb', line 441

def plotSingleRun
  methods.grep(/^plotSingleRun_/){|m|
    self.send(m)
  }
  sleep(1)
end

#plotSingleRun_AcceptedObject



475
476
477
478
479
480
481
482
483
484
485
486
487
488
# File 'lib/flukso/plots.rb', line 475

def plotSingleRun_Accepted
  drawcmd=<<-END_OF_CMD
    l<-length(data$Accepted)
    range<-1:l
    plot(range, data$Accepted, type="n",
      main="Number of Accepted Solutions",
      xlab="Iteration",
      ylab="# Accepted"
    )
    points(range, data$Accepted, pch=1)
  END_OF_CMD
  outfile="sa-accepted-"+@loadlevel.to_s
  @runner.execute(@datafile, outfile, drawcmd)
end

#plotSingleRun_EnergyObject



447
448
449
450
451
452
453
454
455
456
457
458
459
460
# File 'lib/flukso/plots.rb', line 447

def plotSingleRun_Energy
  drawcmd=<<-END_OF_CMD
    l<-length(data$Energy)
    range<-1:l
    plot(range, data$Energy, type="n",
      main="Energy of the Solutions",
      xlab="Iteration",
      ylab="Absolute Energy"
    )
    points(range, data$Energy)
  END_OF_CMD
  outfile="sa-energy-"+@loadlevel.to_s
  @runner.execute(@datafile, outfile, drawcmd)
end

#plotSingleRun_TemperatureObject



461
462
463
464
465
466
467
468
469
470
471
472
473
474
# File 'lib/flukso/plots.rb', line 461

def plotSingleRun_Temperature
  drawcmd=<<-END_OF_CMD
    l<-length(data$Temperature)
    range<-1:l
    plot(range, data$Temperature, type="n",
      main="Temperature of the Solutions",
      xlab="Iteration",
      ylab="Temperature"
    )
    points(range, data$Temperature, pch=1)
  END_OF_CMD
  outfile="sa-temperature-"+@loadlevel.to_s
  @runner.execute(@datafile, outfile, drawcmd)
end