陈清红
2025-04-14 880f3c0257eeb8c37761d484258fdd102a369a19
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
Quintiq file version 2.0
#parent: #root
Method Modify (
  GraphProgram program
)
{
  TextBody:
  [*
    // Create new Shortest Path algorithm after edge value set "weights" have been updated
    
    debuginfo( 'EXECUTE GRAPH ALGORITHM',
               'Graph:', MEIO_Treeify::GetGraphName(this.MEIO_Engine().Product_MP().Name()) );
    
    graph := program.Graph( MEIO_Treeify::GetGraphName(this.MEIO_Engine().Product_MP().Name()), this );
    
    program.RemoveAllAlgorithms();
    
    weights := program.EdgeValueSet( MEIO_Treeify::GetEdgeValueSetWeights() );
    root := select( graph, Nodes, node, node.Name() = MEIO_Treeify::GetArtificialRootName() );
    sp := program.NewShortestPathAlgorithm( MEIO_Treeify::GetShortestPathName(), graph, weights );
    
    // Add configurations from all non-root nodes to root node
    traverse( graph, Nodes, node, root <> node )
    {
      sp.AddConfiguration( root, node, 1 );
    }
  *]
}