lazhen
2025-01-09 8afe90b633046db39042aada36b88193062f8cff
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
Quintiq file version 2.0
#parent: #root
Method Setup (
  String description,
  String strategydescription
)
{
  Description: 'Maintain by R&D'
  TextBody:
  [*
    // jasperb Feb-22-2012 (created)
    
    if( this.BenchmarkProblemId() = - 1 )
    {
      error( 'BenchmarkUtilities::BenchmarkProblem was not called or failed' );
    }
    
    if( this.SetupId() <> -1 )
    {
      error( 'BenchmarkUtilities::Setup was called already' );
    }
    
    machine := OS::ComputerName();
    quintiqversion := Kernel::Version();
    modelversion := DomainModel::Domain().Version().Version();
    
    if( this.AutoSave() )
    {
      //TODO check if save is needed, now always saving and incrementing version number
    
      info( DomainModel::Domain().Version().Version() );
    
      //force save also do DomainModel::Domain().IOManager().WriteAll();
      ok := DomainModel::Domain().PersistencyManager().Export();
      info( 'DomainModel::Domain().PersistencyManager().Export():', ok );
    
      info( DomainModel::Domain().Version().Version() );
    }
    
    if( this.ExportQPA() )
    {
      error( 'Exporting QPA not supported in Quintiq 5.0' );
    }
    
    /* Read .qpa/.qproject info from "cfg" file */
    modelfilename := BenchmarkUtilities::GetStringFromFile( 'modelfilename' );
    pyscriptfilename := BenchmarkUtilities::GetStringFromFile( 'pyscriptfilename' );
    runscriptfilename := BenchmarkUtilities::GetStringFromFile( 'runscriptfilename' );
    
    basedir := BenchmarkUtilities::GetQuintiqBaseDir();
    BenchmarkUtilities::MakeSQLCompatible(basedir);
    BenchmarkUtilities::MakeSQLCompatible(modelfilename);
    BenchmarkUtilities::MakeSQLCompatible(pyscriptfilename);
    BenchmarkUtilities::MakeSQLCompatible(runscriptfilename);
    
    setupid := this.GetOrCreate( "setup",
                                 "benchmarkproblemid,machine,quintiqversion,modelversion,modelfilename,description,strategydescription,quintiqbasedir,pyscriptfilename,runscriptfilename",
                                 "",
                                 [String] this.BenchmarkProblemId() + ",'" + machine + "','" + quintiqversion + "','" + modelversion + "','" + modelfilename + "','" + description + "','" + strategydescription + "','" + basedir + "','" + pyscriptfilename + "','" + runscriptfilename + "'",
                                 "" );
    this.SetupId(setupid);
  *]
}