1 /*
2  * Copyright 2017, Max Planck Society.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without modification,
6  * are permitted provided that the following conditions are met:
7  *
8  * 1. Redistributions of source code must retain the above copyright notice,
9  *    this list of conditions and the following disclaimer.
10  *
11  * 2. Redistributions in binary form must reproduce the above copyright notice,
12  *    this list of conditions and the following disclaimer in the documentation
13  *    and/or other materials provided with the distribution.
14  *
15  * 3. Neither the name of the copyright holder nor the names of its contributors
16  *    may be used to endorse or promote products derived from this software without
17  *    specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22  * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
23  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
24  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
26  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
27  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28  * OF THE POSSIBILITY OF SUCH DAMAGE.
29  *
30  */
31 
32 /* Created by Edgar Klenske <edgar.klenske@tuebingen.mpg.de>
33  */
34 
35 #include "gaussian_process_guider.h"
36 #include "guide_performance_tools.h"
37 
main(int argc,char ** argv)38 int main(int argc, char** argv)
39 {
40     if (argc < 15)
41         return -1;
42 
43     GaussianProcessGuider* GPG;
44 
45     GaussianProcessGuider::guide_parameters parameters;
46 
47     // use parameters from command line
48     parameters.control_gain_ = std::stod(argv[2]);
49     parameters.min_periods_for_inference_ = std::stod(argv[3]);
50     parameters.min_move_ = std::stod(argv[4]);
51     parameters.SE0KLengthScale_ = std::stod(argv[5]);
52     parameters.SE0KSignalVariance_ = std::stod(argv[6]);
53     parameters.PKLengthScale_ = std::stod(argv[7]);
54     parameters.PKPeriodLength_ = std::stod(argv[8]);
55     parameters.PKSignalVariance_ = std::stod(argv[9]);
56     parameters.SE1KLengthScale_ = std::stod(argv[10]);
57     parameters.SE1KSignalVariance_ = std::stod(argv[11]);
58     parameters.min_periods_for_period_estimation_ = std::stod(argv[12]);
59     parameters.points_for_approximation_ = static_cast<int>(std::floor(std::stod(argv[13])));
60     parameters.prediction_gain_ = std::stod(argv[14]);
61     parameters.compute_period_ = true;
62 
63     GPG = new GaussianProcessGuider(parameters);
64 
65     GAHysteresis GAH;
66 
67     std::string filename;
68 
69     filename = argv[1];
70     double improvement = calculate_improvement(filename, GAH, GPG);
71 
72     std::cout << improvement << std::endl;
73 
74     return 0;
75 }
76