Commit 00874e8d authored by frey_m's avatar frey_m
Browse files

Merge branch '498-file-header-for-sampler-classes' into 'master'

Resolve "File header for Sampler classes"

Closes #498

See merge request !316
parents db3237dd 9c97ea2b
//
// Class FromFile
// This class parses a file that contains design variable values.
// Each column belongs to a design variable.
// The first line is considered as header and consists of the
// design variable name. The name has to agree with the string
// in the input file.
//
// Copyright (c) 2018, Matthias Frey, Paul Scherrer Institut, Villigen PSI, Switzerland
// All rights reserved
//
// Implemented as part of the PhD thesis
// "Precise Simulations of Multibunches in High Intensity Cyclotrons"
//
// This file is part of OPAL.
//
// OPAL is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// You should have received a copy of the GNU General Public License
// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
//
#ifndef OPAL_SEQUENCE_H
#define OPAL_SEQUENCE_H
......@@ -11,13 +35,6 @@
#include <vector>
/**
* Parse file that contains design variable values.
* Each column belongs to a design variable.
* The first line is considered as header and consists of the
* design variable name. The name has to agree with the string
* in the input file.
*/
class FromFile : public SamplingMethod
{
......
//
// Class LatinHyperCube
// This class does Latin hypercube sampling.
//
// Copyright (c) 2018, Matthias Frey, Paul Scherrer Institut, Villigen PSI, Switzerland
// All rights reserved
//
// Implemented as part of the PhD thesis
// "Precise Simulations of Multibunches in High Intensity Cyclotrons"
//
// This file is part of OPAL.
//
// OPAL is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// You should have received a copy of the GNU General Public License
// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
//
#ifndef OPAL_LATIN_HYPERCUBE_H
#define OPAL_LATIN_HYPERCUBE_H
......
//
// Class Normal
// This class provides normally distributed samples.
//
// Copyright (c) 2018, Christof Metzger-Kraus, Open Sourcerer
// All rights reserved
//
// This file is part of OPAL.
//
// OPAL is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// You should have received a copy of the GNU General Public License
// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
//
#ifndef OPAL_NORMAL_RANDOM_SAMPLING_H
#define OPAL_NORMAL_RANDOM_SAMPLING_H
......
//
// Class OpalSample
// The SAMPLING definition.
// A SAMPLING definition is used to run the optimizer in sample mode.
//
// Copyright (c) 2018, Matthias Frey, Paul Scherrer Institut, Villigen PSI, Switzerland
// All rights reserved
//
// Implemented as part of the PhD thesis
// "Precise Simulations of Multibunches in High Intensity Cyclotrons"
//
// This file is part of OPAL.
//
// OPAL is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// You should have received a copy of the GNU General Public License
// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
//
#include "Sample/OpalSample.h"
#include "AbstractObjects/OpalData.h"
......@@ -14,9 +35,6 @@
#include "Sample/SampleRandomizedSequence.h"
// Class OpalSample
// ------------------------------------------------------------------------
// The attributes of class OpalSample.
namespace {
enum {
......
//
// Class OpalSample
// The SAMPLING definition.
// A SAMPLING definition is used to run the optimizer in sample mode.
//
// Copyright (c) 2018, Matthias Frey, Paul Scherrer Institut, Villigen PSI, Switzerland
// All rights reserved
//
// Implemented as part of the PhD thesis
// "Precise Simulations of Multibunches in High Intensity Cyclotrons"
//
// This file is part of OPAL.
//
// OPAL is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// You should have received a copy of the GNU General Public License
// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
//
#ifndef OPAL_SAMPLE_H
#define OPAL_SAMPLE_H
......@@ -7,11 +28,6 @@
#include "Sample/SamplingMethod.h"
// Class OpalSample
// ------------------------------------------------------------------------
/// The SAMPLING definition.
// A SAMPLING definition is used run the optimizer in sample mode.
class OpalSample: public Definition {
public:
......
//
// Class RNGStream
// This class takes care of RNG generator instances.
//
// Copyright (c) 2018, Christof Metzger-Kraus, Open Sourcerer
// All rights reserved
//
// This file is part of OPAL.
//
// OPAL is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// You should have received a copy of the GNU General Public License
// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
//
#include "Sample/RNGStream.h"
#include <iostream>
......
//
// Class RNGStream
// This class takes care of RNG generator instances.
//
// Copyright (c) 2018, Christof Metzger-Kraus, Open Sourcerer
// All rights reserved
//
// This file is part of OPAL.
//
// OPAL is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// You should have received a copy of the GNU General Public License
// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
//
#ifndef RNGSTREAM_H
#define RNGSTREAM_H
......
//
// Class SampleCmd
// This class defines the SAMPLE command.
//
// Copyright (c) 2018, Matthias Frey, Paul Scherrer Institut, Villigen PSI, Switzerland
// All rights reserved
//
// Implemented as part of the PhD thesis
// "Precise Simulations of Multibunches in High Intensity Cyclotrons"
//
// This file is part of OPAL.
//
// OPAL is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// You should have received a copy of the GNU General Public License
// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
//
#include "Sample/SampleCmd.h"
#include "Sample/Sampler.h"
#include "Sample/OpalSample.h"
......
//
// Class SampleCmd
// This class defines the SAMPLE command.
//
// Copyright (c) 2018, Matthias Frey, Paul Scherrer Institut, Villigen PSI, Switzerland
// All rights reserved
//
// Implemented as part of the PhD thesis
// "Precise Simulations of Multibunches in High Intensity Cyclotrons"
//
// This file is part of OPAL.
//
// OPAL is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// You should have received a copy of the GNU General Public License
// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
//
#ifndef OPAL_SampleCmd_HH
#define OPAL_SampleCmd_HH
......@@ -5,10 +25,6 @@
#include <string>
// Class SampleCmd
// ------------------------------------------------------------------------
/// The SAMPLE command.
class SampleCmd: public Action {
public:
......
//
// Class SampleGaussianSequence
// This class provides a sequence of sampling points that have a Gaussian distribution
// with
// mean = 0.5 * (upper + lower)
// sigma = (upper - lower) / 10
// This can be achieved if the integral of the Gaussian between the sampling
// points are all equal. The sampling points are therefore computed using
// the inverse error function at equally distributed arguments between
// -1 and 1.
//
// Copyright (c) 2018, Christof Metzger-Kraus, Open Sourcerer
// All rights reserved
//
// This file is part of OPAL.
//
// OPAL is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// You should have received a copy of the GNU General Public License
// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
//
#ifndef OPAL_SAMPLE_GAUSSIAN_SEQUENCE_H
#define OPAL_SAMPLE_GAUSSIAN_SEQUENCE_H
......@@ -10,14 +34,6 @@
class SampleGaussianSequence : public SamplingMethod
{
// provides a sequence of sampling points that have a Gaussian distribution
// with
// mean = 0.5 * (upper + lower)
// sigma = (upper - lower) / 10
// This can be achieved if the integral of the Gaussian between the sampling
// points are all equal. The sampling points are therefore computed using
// the inverse error function at equally distributed arguments between
// -1 and 1.
public:
......
//
// Class SampleIndividual
// Structure for an individual in the population holding genes values.
//
// Copyright (c) 2018, Matthias Frey, Paul Scherrer Institut, Villigen PSI, Switzerland
// Yves Ineichen, ETH Zürich
// All rights reserved
//
// Implemented as part of the PhD thesis
// "Precise Simulations of Multibunches in High Intensity Cyclotrons"
//
// This file is part of OPAL.
//
// OPAL is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// You should have received a copy of the GNU General Public License
// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
//
#ifndef __SAMPLE_INDIVIDUAL_H__
#define __SAMPLE_INDIVIDUAL_H__
......@@ -13,13 +34,6 @@
#include "boost/smart_ptr.hpp"
/**
* \class SampleIndividual
* Structure for an individual in the population holding genes
* values.
*
* @see Types.h
*/
class SampleIndividual {
public:
......
//
// Class SamplePilot
// The sample Pilot (Master): Coordinates requests by sampler to workers.
// Every worker thread notifies the master here if idle or not. When
// available the master dispatches one of the pending simulations to the
// worker who will run the specified simulation and report results back to
// the master.
// @see SampleWorker
// @see Sampler
// @tparam Opt_t type of the sampler
// @tparam Sim_t type of the simulation
// @tparam SolPropagationGraph_t strategy to distribute solution between
// master islands
// @tparam Comm_t comm splitter strategy
//
// Copyright (c) 2018, Matthias Frey, Paul Scherrer Institut, Villigen PSI, Switzerland
// Yves Ineichen, ETH Zürich
// All rights reserved
//
// Implemented as part of the PhD thesis
// "Precise Simulations of Multibunches in High Intensity Cyclotrons"
//
// This file is part of OPAL.
//
// OPAL is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// You should have received a copy of the GNU General Public License
// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
//
#ifndef __SAMPLE_PILOT_H__
#define __SAMPLE_PILOT_H__
......@@ -5,25 +37,6 @@
#include "Sample/SampleWorker.h"
#include "Expression/Parser/function.hpp"
/**
* \class SamplePilot
* \brief The sample Pilot (Master): Coordinates requests by sampler
* to workers.
*
* Every worker thread notifies the master here if idle or not. When
* available the master dispatches one of the pending simulations to the
* worker who will run the specified simulation and report results back to
* the master.
*
* @see SampleWorker
* @see Sampler
*
* @tparam Opt_t type of the sampler
* @tparam Sim_t type of the simulation
* @tparam SolPropagationGraph_t strategy to distribute solution between
* master islands
* @tparam Comm_t comm splitter strategy
*/
template <
class Opt_t
, class Sim_t
......
//
// Class SampleRandomizedSequence
// This class creates randomized sequences, i.e., it randomly picks values from
// a sequence.
//
// Copyright (c) 2019, Matthias Frey, Paul Scherrer Institut, Villigen PSI, Switzerland
// All rights reserved
//
// Implemented as part of the PhD thesis
// "Precise Simulations of Multibunches in High Intensity Cyclotrons"
//
// This file is part of OPAL.
//
// OPAL is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// You should have received a copy of the GNU General Public License
// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
//
#ifndef OPAL_SAMPLE_WEIGHTED_SEQUENCE_H
#define OPAL_SAMPLE_WEIGHTED_SEQUENCE_H
......
//
// Class SampleSequence
// This class provides a sequence of equidistant sampling points. It
// can't be garanteed that the sampling is equidistant if
// an integer type is chosen and the difference between
// the upper and lower limit isn't divisible by the number
// of sampling points.
//
// Copyright (c) 2018, Christof Metzger-Kraus, Open Sourcerer
// All rights reserved
//
// This file is part of OPAL.
//
// OPAL is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// You should have received a copy of the GNU General Public License
// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
//
#ifndef OPAL_SAMPLE_SEQUENCE_H
#define OPAL_SAMPLE_SEQUENCE_H
......@@ -6,11 +27,6 @@
template <typename T>
class SampleSequence : public SamplingMethod
{
// provides a sequence of equidistant sampling points. It
// can't be garanteed that the sampling is equidistant if
// an integer type is chosen and the difference between
// the upper and lower limit isn't divisible by the number
// of sampling points.
public:
......
//
// Class SampleWorker
// A worker MPI entity consists of a processor group that runs a
// simulation of type Sim_t. The main loop in run() accepts new jobs from the
// master process runs the simulation and reports back the results.
//
// @see SamplePilot
// @see Worker
// @see MPIHelper.h
//
// @tparam Sim_T type of simulation to run
//
// Copyright (c) 2018, Matthias Frey, Paul Scherrer Institut, Villigen PSI, Switzerland
// Yves Ineichen, ETH Zürich
// All rights reserved
//
// Implemented as part of the PhD thesis
// "Precise Simulations of Multibunches in High Intensity Cyclotrons"
//
// This file is part of OPAL.
//
// OPAL is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// You should have received a copy of the GNU General Public License
// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
//
#ifndef __SAMPLE_WORKER_H__
#define __SAMPLE_WORKER_H__
#include "Pilot/Worker.h"
/**
* \class SampleWorker
* \brief A worker MPI entity consists of a processor group that runs a
* simulation of type Sim_t. The main loop in run() accepts new jobs from the
* master process runs the simulation and reports back the results.
*
* @see SamplePilot
* @see Worker
* @see MPIHelper.h
*
* @tparam Sim_T type of simulation to run
*/
template <class Sim_t>
class SampleWorker : protected Worker<Sim_t> {
......
//
// Class Sampler
// This class creates, dispatches and dumps new individuals.
//
// Copyright (c) 2018, Matthias Frey, Paul Scherrer Institut, Villigen PSI, Switzerland
// Yves Ineichen, ETH Zürich
// All rights reserved
//
// Implemented as part of the PhD thesis
// "Precise Simulations of Multibunches in High Intensity Cyclotrons"
//
// This file is part of OPAL.
//
// OPAL is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// You should have received a copy of the GNU General Public License
// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
//
#include <iostream>
#include <string>
#include <limits>
......
//
// Class Sampler
// This class creates, dispatches and dumps new individuals.
//
// Copyright (c) 2018, Matthias Frey, Paul Scherrer Institut, Villigen PSI, Switzerland
// Yves Ineichen, ETH Zürich
// All rights reserved
//
// Implemented as part of the PhD thesis
// "Precise Simulations of Multibunches in High Intensity Cyclotrons"
//
// This file is part of OPAL.
//
// OPAL is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// You should have received a copy of the GNU General Public License
// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
//
#ifndef __OPAL_SAMPLER_H__
#define __OPAL_SAMPLER_H__
......@@ -31,13 +52,6 @@
#include <boost/property_tree/ptree.hpp>
/**
* \class Sampler
* \brief Implementing sampling
*/
// template<
// template <class> class SamplingOperator
// >
class Sampler : public Optimizer {
public:
......
//
// Class SamplingMethod
// Base class for all sampling methods.
//
// Copyright (c) 2018, Matthias Frey, Paul Scherrer Institut, Villigen PSI, Switzerland
// All rights reserved
//
// Implemented as part of the PhD thesis
// "Precise Simulations of Multibunches in High Intensity Cyclotrons"
//
// This file is part of OPAL.
//
// OPAL is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// You should have received a copy of the GNU General Public License
// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
//
#ifndef OPAL_SAMPLING_METHOD_H
#define OPAL_SAMPLING_METHOD_H
......
//
// Class Uniform
// This class creates uniformly distributed samples.
//
// Copyright (c) 2018, Matthias Frey, Paul Scherrer Institut, Villigen PSI, Switzerland
// All rights reserved
//
// Implemented as part of the PhD thesis
// "Precise Simulations of Multibunches in High Intensity Cyclotrons"
//
// This file is part of OPAL.
//
// OPAL is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// You should have received a copy of the GNU General Public License
// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
//
#ifndef OPAL_UNIFORM_H
#define OPAL_UNIFORM_H
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment