@@ -3859,7 +3859,7 @@ algorithm
38593859end estimateCosts0;
38603860
38613861
3862- protected function estimateCosts1 " estimates the exeCost for 1 StrongComponent
3862+ protected function estimateCosts1 " estimates the exeCost for one StrongComponent
38633863author: Waurich TUD 2013-09"
38643864 input BackendDAE . StrongComponent compIn;
38653865 input BackendDAE . EqSystem eqSysIn;
@@ -3874,7 +3874,6 @@ algorithm
38743874 equation
38753875 ((costAdd,costMul,costTrig)) = countOperations(compIn, eqSysIn, sharedIn);
38763876 numOps = costAdd+ costMul+ costTrig;
3877- print("compIN " +& BackendDump . printComponent(compIn)+& " with operations: " +& intString(numOps)+& " \n " );
38783877 costs = realAdd(realMul(intReal(numOps),25 . 0 ),70 . 0 ); // feel free to change this
38793878 then
38803879 ((numOps,costs));
@@ -3903,35 +3902,67 @@ protected function checkForExecutionCosts "checks if every entry in exeCosts is
39033902 input TaskGraphMeta dataIn;
39043903 output Boolean isFine;
39053904protected
3905+ array< list< Integer >> inComps;
39063906 array< tuple< Integer ,Real >> exeCosts;
39073907algorithm
3908- TASKGRAPHMETA (exeCosts= exeCosts) := dataIn;
3909- isFine := Util . arrayFold (exeCosts,checkTplForZero2, true );
3910- Debug . bcall(not isFine,print,"there are execution costs with value 0.0! \n " );
3908+ TASKGRAPHMETA (inComps = inComps, exeCosts= exeCosts) := dataIn;
3909+ isFine := checkForExecutionCosts1 (exeCosts,inComps, 1 );
3910+ Debug . bcall(not isFine,print,"There are execution costs with value 0.0! \n " );
39113911end checkForExecutionCosts;
39123912
39133913
3914- protected function checkTplForZero2 "returns false if the second number(real) in the tuple is zero
3914+ protected function checkForExecutionCosts1 "checks if the comp for the given node has an executionCost > 0.0
39153915author: Waurich TUD 2013-09"
3916- input tuple< Integer ,Real > inTpl;
3917- input Boolean bIn;
3916+ input array< tuple< Integer ,Real >> exeCosts;
3917+ input array< list< Integer >> inComps;
3918+ input Integer nodeIdx;
39183919 output Boolean bOut;
39193920algorithm
3920- bOut := matchcontinue(inTpl,bIn )
3921+ bOut := matchcontinue(exeCosts,inComps,nodeIdx )
39213922 local
3923+ Boolean b, isZero;
3924+ list< Integer > comps;
39223925 Real value;
3923- case ((_,value),true )
3926+ tuple< Integer ,Real > tpl;
3927+ case (_,_,_)
39243928 equation
3925- false = realEq(value,0 . 0 );
3929+ true = arrayLength(inComps) >= nodeIdx;
3930+ comps = arrayGet(inComps,nodeIdx);
3931+ isZero = List . fold1(comps,checkTpl2ForZero,exeCosts,false );
3932+ false = isZero;
3933+ b = checkForExecutionCosts1(exeCosts,inComps,nodeIdx+ 1 );
39263934 then
3927- true ;
3935+ b;
3936+ case (_,_,_)
3937+ equation
3938+ true = arrayLength(inComps) < nodeIdx;
3939+ then
3940+ true ;
39283941 else
39293942 equation
39303943 then
39313944 false ;
39323945 end matchcontinue;
3933- end checkTplForZero2;
3934-
3946+ end checkForExecutionCosts1;
3947+
3948+
3949+ protected function checkTpl2ForZero "folding function for checkForExecutionCosts1
3950+ author:Waurich TUD 2013-09"
3951+ input Integer comp;
3952+ input array< tuple< Integer ,Real >> exeCosts;
3953+ input Boolean bIn;
3954+ output Boolean bOut;
3955+ protected
3956+ Boolean b;
3957+ Real value;
3958+ tuple< Integer ,Real > tpl;
3959+ algorithm
3960+ tpl := arrayGet(exeCosts,comp);
3961+ (_,value) := tpl;
3962+ b := realEq(value,0 . 0 );
3963+ bOut := b or bIn;
3964+ end checkTpl2ForZero;
3965+
39353966
39363967public function convertNodeListToEdgeTuples "author: marcusw
39373968 Convert a list of nodes to a list of edged. E.g. {1,2,5} -> {(1,2),(2,5)}"
0 commit comments