Skip to content

Commit d307360

Browse files
author
Jens Frenkel
committed
- remove Boolean output from past optimisation modules (modules have to change matching of equation system if rerun of matching algorithm is necessary)
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@12593 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
1 parent 6e4bd24 commit d307360

File tree

4 files changed

+23
-197
lines changed

4 files changed

+23
-197
lines changed

Compiler/BackEnd/BackendDAEOptimize.mo

Lines changed: 10 additions & 157 deletions
Original file line numberDiff line numberDiff line change
@@ -90,19 +90,6 @@ protected import Uncertainties;
9090
* inline arrayeqns stuff
9191
*
9292
*/
93-
public function inlineArrayEqnPast "function inlineArrayEqnPast
94-
autor: Frenkel TUD 2011-3"
95-
input BackendDAE.BackendDAE inDAE;
96-
output BackendDAE.BackendDAE outDAE;
97-
output Boolean outRunMatching;
98-
protected
99-
Option<BackendDAE.IncidenceMatrix> om,omT;
100-
BackendDAE.EqSystem syst;
101-
BackendDAE.Shared shared;
102-
algorithm
103-
(outDAE,outRunMatching) := BackendDAEUtil.mapEqSystemAndFold(inDAE,inlineArrayEqn1,false);
104-
end inlineArrayEqnPast;
105-
10693
public function inlineArrayEqn "function inlineArrayEqn
10794
autor: Frenkel TUD 2011-3"
10895
input BackendDAE.BackendDAE inDAE;
@@ -277,10 +264,8 @@ end generateScalarArrayEqns2;
277264
public function lateInlineFunction "function lateInlineFunction"
278265
input BackendDAE.BackendDAE inDAE;
279266
output BackendDAE.BackendDAE outDAE;
280-
output Boolean outRunMatching;
281267
algorithm
282268
outDAE := Inline.inlineCalls({DAE.NORM_INLINE(),DAE.AFTER_INDEX_RED_INLINE()},inDAE);
283-
outRunMatching := true;
284269
end lateInlineFunction;
285270

286271

@@ -365,20 +350,6 @@ algorithm
365350
end removeSimpleEquationsFast1New;
366351
*/
367352

368-
public function removeSimpleEquationsFastPast "function removeSimpleEquationsFastPast"
369-
input BackendDAE.BackendDAE inDAE;
370-
output BackendDAE.BackendDAE outDAE;
371-
output Boolean outRunMatching;
372-
protected
373-
BackendVarTransform.VariableReplacements repl,repl1;
374-
algorithm
375-
repl := BackendVarTransform.emptyReplacements();
376-
(outDAE,(repl1,outRunMatching)) := BackendDAEUtil.mapEqSystemAndFold(inDAE,removeSimpleEquationsFast1,(repl,false));
377-
outDAE := removeSimpleEquationsShared(outRunMatching,outDAE,repl1);
378-
outDAE := BackendDAEUtil.mapEqSystem(outDAE,BackendDAEUtil.getIncidenceMatrixfromOptionForMapEqSystem);
379-
// until remove simple equations does not update assignments and comps
380-
end removeSimpleEquationsFastPast;
381-
382353
public function removeSimpleEquationsFast
383354
"function: removeSimpleEquationsFast
384355
autor: Frenkel TUD 2012-03
@@ -611,13 +582,13 @@ public function removeSimpleEquationsPast
611582
autor: Frenkel TUD 2012-13"
612583
input BackendDAE.BackendDAE inDAE;
613584
output BackendDAE.BackendDAE outDAE;
614-
output Boolean outRunMatching;
615585
protected
616586
BackendVarTransform.VariableReplacements repl,repl1;
587+
Boolean b;
617588
algorithm
618589
repl := BackendVarTransform.emptyReplacements();
619-
(outDAE,(repl1,outRunMatching)) := BackendDAEUtil.mapEqSystemAndFold(inDAE,removeSimpleEquationsPast1,(repl,false));
620-
outDAE := removeSimpleEquationsShared(outRunMatching,outDAE,repl1);
590+
(outDAE,(repl1,b)) := BackendDAEUtil.mapEqSystemAndFold(inDAE,removeSimpleEquationsPast1,(repl,false));
591+
outDAE := removeSimpleEquationsShared(b,outDAE,repl1);
621592
// until remove simple equations does not update assignments and comps
622593
end removeSimpleEquationsPast;
623594

@@ -3029,19 +3000,6 @@ end evaluateFinalParameters;
30293000
* remove final paramters stuff
30303001
*
30313002
*/
3032-
public function removeFinalParametersPast
3033-
"function removeFinalParametersPast"
3034-
input BackendDAE.BackendDAE inDAE;
3035-
output BackendDAE.BackendDAE outDAE;
3036-
output Boolean outRunMatching;
3037-
protected
3038-
BackendVarTransform.VariableReplacements repl,repl1;
3039-
algorithm
3040-
outDAE := removeFinalParameters(inDAE);
3041-
outRunMatching := true;
3042-
// until remove simple equations does not update assignments and comps
3043-
end removeFinalParametersPast;
3044-
30453003
public function removeFinalParameters
30463004
"function: removeFinalParameters
30473005
autor Frenkel TUD"
@@ -3466,20 +3424,6 @@ end evaluateParameters;
34663424
* remove all parameter with evaluate=true Annotation
34673425
*/
34683426

3469-
3470-
public function removeevaluateParametersPast
3471-
"function removeevaluateParametersPast"
3472-
input BackendDAE.BackendDAE inDAE;
3473-
output BackendDAE.BackendDAE outDAE;
3474-
output Boolean outRunMatching;
3475-
protected
3476-
BackendVarTransform.VariableReplacements repl,repl1;
3477-
algorithm
3478-
outDAE := removeevaluateParameters(inDAE);
3479-
outRunMatching := true;
3480-
// until remove simple equations does not update assignments and comps
3481-
end removeevaluateParametersPast;
3482-
34833427
public function removeevaluateParameters
34843428
"function: removeevaluateParameters
34853429
autor Frenkel TUD"
@@ -3783,23 +3727,6 @@ end hasEvaluateAnnotation;
37833727
* remove equal function calls equations stuff
37843728
*
37853729
*/
3786-
public function removeEqualFunctionCallsPast
3787-
"function removeEqualFunctionCallsPast"
3788-
input BackendDAE.BackendDAE inDAE;
3789-
output BackendDAE.BackendDAE outDAE;
3790-
output Boolean outRunMatching;
3791-
protected
3792-
Option<BackendDAE.IncidenceMatrix> om,omT;
3793-
Boolean b;
3794-
BackendDAE.EqSystem syst;
3795-
BackendDAE.Shared shared;
3796-
algorithm
3797-
BackendDAE.DAE({syst},shared) := inDAE;
3798-
(syst,shared,b) := removeEqualFunctionCalls1(syst,shared);
3799-
outRunMatching := b; // until does not update assignments and comps
3800-
outDAE := BackendDAE.DAE({syst},shared);
3801-
end removeEqualFunctionCallsPast;
3802-
38033730
public function removeEqualFunctionCalls
38043731
"function: removeEqualFunctionCalls
38053732
autor: Frenkel TUD 2011-04
@@ -3812,19 +3739,6 @@ algorithm
38123739
end removeEqualFunctionCalls;
38133740

38143741
protected function removeEqualFunctionCallsWork
3815-
"function: removeEqualFunctionCalls
3816-
autor: Frenkel TUD 2011-04
3817-
This function detect equal function call on the form a=f(b) and c=f(b)
3818-
in BackendDAE.BackendDAE to get speed up"
3819-
input BackendDAE.EqSystem syst;
3820-
input BackendDAE.Shared shared;
3821-
output BackendDAE.EqSystem osyst;
3822-
output BackendDAE.Shared oshared;
3823-
algorithm
3824-
(osyst,oshared,_) := removeEqualFunctionCalls1(syst,shared);
3825-
end removeEqualFunctionCallsWork;
3826-
3827-
protected function removeEqualFunctionCalls1
38283742
"function: removeEqualFunctionCalls
38293743
autor: Frenkel TUD 2011-04
38303744
This function detect equal function call on the form a=f(b) and c=f(b)
@@ -3833,9 +3747,8 @@ protected function removeEqualFunctionCalls1
38333747
input BackendDAE.Shared ishared;
38343748
output BackendDAE.EqSystem osyst;
38353749
output BackendDAE.Shared oshared;
3836-
output Boolean optimized;
38373750
algorithm
3838-
(osyst,oshared,optimized) := match (isyst,ishared)
3751+
(osyst,oshared) := match (isyst,ishared)
38393752
local
38403753
BackendDAE.IncidenceMatrix m,m_1;
38413754
BackendDAE.IncidenceMatrixT mT,mT_1;
@@ -3855,9 +3768,9 @@ algorithm
38553768
// update arrayeqns and algorithms, collect info for wrappers
38563769
syst = BackendDAE.EQSYSTEM(vars,eqns,SOME(m_1),SOME(mT_1),BackendDAE.NO_MATCHING());
38573770
syst = BackendDAEUtil.updateIncidenceMatrix(syst,shared,changed);
3858-
then (syst,shared,b);
3771+
then (syst,shared);
38593772
end match;
3860-
end removeEqualFunctionCalls1;
3773+
end removeEqualFunctionCallsWork;
38613774

38623775
protected function removeEqualFunctionCallFinder
38633776
"autor: Frenkel TUD 2010-12"
@@ -4049,21 +3962,6 @@ end replaceExp;
40493962
* remove unused parameter
40503963
*/
40513964

4052-
public function removeUnusedParameterPast
4053-
"function removeUnusedParameterPast"
4054-
input BackendDAE.BackendDAE inDAE;
4055-
output BackendDAE.BackendDAE outDAE;
4056-
output Boolean outRunMatching;
4057-
protected
4058-
Option<BackendDAE.IncidenceMatrix> om,omT;
4059-
BackendDAE.EqSystem syst;
4060-
BackendDAE.Shared shared;
4061-
algorithm
4062-
(outDAE as BackendDAE.DAE({syst},shared)) := removeUnusedParameter(inDAE);
4063-
(syst,_,_) := BackendDAEUtil.getIncidenceMatrixfromOption(syst,shared,BackendDAE.NORMAL());
4064-
outRunMatching := false;
4065-
end removeUnusedParameterPast;
4066-
40673965
public function removeUnusedParameter
40683966
"function: removeUnusedParameter
40693967
autor: Frenkel TUD 2011-04
@@ -4205,20 +4103,6 @@ end checkUnusedParameterExp;
42054103
* remove unused variables
42064104
*/
42074105

4208-
public function removeUnusedVariablesPast
4209-
"function removeUnusedVariablesPast"
4210-
input BackendDAE.BackendDAE inDAE;
4211-
output BackendDAE.BackendDAE outDAE;
4212-
output Boolean outRunMatching;
4213-
protected
4214-
BackendDAE.EqSystem syst;
4215-
BackendDAE.Shared shared;
4216-
algorithm
4217-
(outDAE as BackendDAE.DAE({syst},shared)) := removeUnusedVariables(inDAE);
4218-
(syst,_,_) := BackendDAEUtil.getIncidenceMatrixfromOption(syst,shared,BackendDAE.NORMAL());
4219-
outRunMatching := false;
4220-
end removeUnusedVariablesPast;
4221-
42224106
public function removeUnusedVariables
42234107
"function: removeUnusedVariables
42244108
autor: Frenkel TUD 2011-04
@@ -4338,19 +4222,6 @@ end checkUnusedVariablesExp;
43384222
* remove unused functions
43394223
*/
43404224

4341-
public function removeUnusedFunctionsPast
4342-
"function removeUnusedFunctionsPast"
4343-
input BackendDAE.BackendDAE inDAE;
4344-
output BackendDAE.BackendDAE outDAE;
4345-
output Boolean outRunMatching;
4346-
protected
4347-
BackendDAE.EqSystem syst;
4348-
BackendDAE.Shared shared;
4349-
algorithm
4350-
outDAE := removeUnusedFunctions(inDAE);
4351-
outRunMatching := false;
4352-
end removeUnusedFunctionsPast;
4353-
43544225
public function removeUnusedFunctions
43554226
"function: removeUnusedFunctions
43564227
autor: Frenkel TUD 2012-03
@@ -4569,9 +4440,8 @@ public function constantLinearSystem
45694440
"function constantLinearSystem"
45704441
input BackendDAE.BackendDAE inDAE;
45714442
output BackendDAE.BackendDAE outDAE;
4572-
output Boolean outRunMatching;
45734443
algorithm
4574-
(outDAE,outRunMatching) := BackendDAEUtil.mapEqSystemAndFold(inDAE,constantLinearSystem0,false);
4444+
(outDAE,_) := BackendDAEUtil.mapEqSystemAndFold(inDAE,constantLinearSystem0,false);
45754445
end constantLinearSystem;
45764446

45774447
protected function constantLinearSystem0
@@ -7148,7 +7018,6 @@ end generateInitialMatrices;
71487018
public function generateSymbolicJacobianPast
71497019
input BackendDAE.BackendDAE inBackendDAE;
71507020
output BackendDAE.BackendDAE outBackendDAE;
7151-
output Boolean outRunMatching;
71527021
protected
71537022
BackendDAE.EqSystems eqs;
71547023
BackendDAE.Shared shared;
@@ -7160,14 +7029,12 @@ algorithm
71607029
shared := BackendDAEUtil.addBackendDAESharedJacobian(symJacA, shared);
71617030
outBackendDAE := BackendDAE.DAE(eqs,shared);
71627031
_ := Flags.enableDebug(Flags.JACOBIAN);
7163-
outRunMatching := false;
71647032
_ := System.realtimeTock(BackendDAE.RT_CLOCK_EXECSTAT_JACOBIANS);
71657033
end generateSymbolicJacobianPast;
71667034

71677035
public function generateSymbolicLinearizationPast
71687036
input BackendDAE.BackendDAE inBackendDAE;
71697037
output BackendDAE.BackendDAE outBackendDAE;
7170-
output Boolean outRunMatching;
71717038
protected
71727039
BackendDAE.EqSystems eqs;
71737040
BackendDAE.Shared shared;
@@ -7179,7 +7046,6 @@ algorithm
71797046
shared := BackendDAEUtil.addBackendDAESharedJacobians(linearModelMatrixes, shared);
71807047
outBackendDAE := BackendDAE.DAE(eqs,shared);
71817048
_ := Flags.enableDebug(Flags.JACOBIAN);
7182-
outRunMatching := false;
71837049
_ := System.realtimeTock(BackendDAE.RT_CLOCK_EXECSTAT_JACOBIANS);
71847050
end generateSymbolicLinearizationPast;
71857051

@@ -9171,16 +9037,6 @@ end mergeTuple;
91719037
* parallel backend stuff
91729038
*
91739039
*/
9174-
public function collapseIndependentBlocksPast
9175-
"Finds independent partitions of the equation system by "
9176-
input BackendDAE.BackendDAE dlow;
9177-
output BackendDAE.BackendDAE outDlow;
9178-
output Boolean outRunMatching;
9179-
algorithm
9180-
outDlow := collapseIndependentBlocks(dlow);
9181-
outRunMatching := true;
9182-
end collapseIndependentBlocksPast;
9183-
91849040
public function collapseIndependentBlocks
91859041
"Finds independent partitions of the equation system by "
91869042
input BackendDAE.BackendDAE dlow;
@@ -9557,9 +9413,8 @@ public function simplifyTimeIndepFuncCalls "function simplifyTimeIndepFuncCalls
95579413
author: Frenkel TUD 2012-06"
95589414
input BackendDAE.BackendDAE inDAE;
95599415
output BackendDAE.BackendDAE outDAE;
9560-
output Boolean outRunMatching;
95619416
algorithm
9562-
(outDAE,outRunMatching) := BackendDAEUtil.mapEqSystemAndFold(inDAE,simplifyTimeIndepFuncCalls0,false);
9417+
(outDAE,_) := BackendDAEUtil.mapEqSystemAndFold(inDAE,simplifyTimeIndepFuncCalls0,false);
95639418
outDAE := simplifyTimeIndepFuncCallsShared(outDAE);
95649419
end simplifyTimeIndepFuncCalls;
95659420

@@ -9682,9 +9537,8 @@ public function tearingSystemNew "function tearingSystem
96829537
author: Frenkel TUD 2012-05"
96839538
input BackendDAE.BackendDAE inDAE;
96849539
output BackendDAE.BackendDAE outDAE;
9685-
output Boolean outRunMatching;
96869540
algorithm
9687-
(outDAE,outRunMatching) := BackendDAEUtil.mapEqSystemAndFold(inDAE,tearingSystemNew0,false);
9541+
(outDAE,_) := BackendDAEUtil.mapEqSystemAndFold(inDAE,tearingSystemNew0,false);
96889542
end tearingSystemNew;
96899543

96909544
protected function tearingSystemNew0 "function tearingSystem0
@@ -11553,9 +11407,8 @@ public function countOperations "function countOperations
1155311407
author: Frenkel TUD 2011-05"
1155411408
input BackendDAE.BackendDAE inDAE;
1155511409
output BackendDAE.BackendDAE outDAE;
11556-
output Boolean outRunMatching;
1155711410
algorithm
11558-
(outDAE,outRunMatching) := BackendDAEUtil.mapEqSystemAndFold(inDAE,countOperations0,false);
11411+
(outDAE,_) := BackendDAEUtil.mapEqSystemAndFold(inDAE,countOperations0,false);
1155911412
end countOperations;
1156011413

1156111414
protected function countOperations0 "function countOperations0

0 commit comments

Comments
 (0)