chenqinghong
2024-05-07 3ec06a830367465068963156dcc1d8e522571c13
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
Quintiq file version 2.0
#parent: #root
Method End (
  Boolean feasible,
  Duration runduration,
  Real KPI0Score,
  Real KPI1Score,
  Real KPI2Score,
  Real KPI3Score,
  String solutionString,
  Boolean signalallfinished
)
{
  Description: 'Maintain by R&D'
  TextBody:
  [*
    // jasperb Feb-22-2012 (created)
    
    /* Finish resultrun */
    this.ResultRun( feasible, KPI0Score, KPI1Score, KPI2Score, KPI3Score, true );
    
    feasiblebit := 0;
    if( feasible )
    {
      feasiblebit := 1;
    }
    
    createdon := this.CreatedOn().Format( 'Y-M2-D2 H:m:s' );
    
    resultid := this.GetOrCreate( "result",
                                  "experimentid,feasible,runduration,createdon,kpi0score,kpi1score,kpi2score,kpi3score,solution",
                                  "",
                                  [String] this.ExperimentId() + "," +
                                  [String] feasiblebit + "," +
                                  [String] runduration.TotalInSeconds() + ",'" +
                                  [String] createdon + "'," +
                                  [String] KPI0Score + "," +
                                  [String] KPI1Score + "," +
                                  [String] KPI2Score + "," +
                                  [String] KPI3Score + ",'" +
                                  solutionString + "'",
                                  "" );
    
    if( resultid = 0 )
    {
      info( 'Hmz, resultid = 0??' );
    }
    
    /* Insert result run (if it exists) */
    traverse( this, BenchmarkResultRun, resultrun, resultid <> 0 )
    {
      feasiblebit := 0;
      if( resultrun.Feasible() )
      {
        feasiblebit := 1;
      }
      runtime := resultrun.Runtime().TotalInSeconds();
    
      this.GetOrCreate( "resultrun",
                        "resultid,runtime,feasible,kpi0score,kpi1score,kpi2score,kpi3score",
                        "",
                        [String] resultid + "," +
                        [String] runtime + "," +
                        [String] feasiblebit + "," +
                        [String] resultrun.KPI0Score() + "," +
                        [String] resultrun.KPI1Score() + "," +
                        [String] resultrun.KPI2Score() + "," +
                        [String] resultrun.KPI3Score(),
                        "" );
    }
    
    this.ExperimentId( -1 );
    this.SetupId( -1 );
    this.BenchmarkProblemId( -1 );
    this.BenchmarkId( -1 );
    this.BenchmarkResultRun( relflush );
    
    if( signalallfinished )
    {
      file := OSFile::Construct()
      file.Open( OS::LogDir() + 'benchmarkendsignal', 'Write', true );
      file.Close();
    }
  *]
}