
++++++++ Energy analysis of class FromPython ++++++++++++

--- --- --- --- --- --- --- --- --- ---
--- --- --- --- --- --- --- --- --- ---
!!! Red flags for operation mc_plain:

!!! Warning (LCE): The expression Integer.subrange(0,N - 1) may be independent of the iterator variables [i, Z, ST, payoff, payoffs]
!!!  Use Extract local variable to optimise.

!!! (LCE) flaw: The expression ( r - 0.5 * (sigma)->pow(2) ) * T may be independent of the iterator variables [i, Z, ST, payoff, payoffs]
!!! Use Extract local variable to optimise.

!! Amber flags for operation mc_plain:

!! (OES) flaw: O(n) operation Integer.subrange(0,N - 1) within loop may be O(n*n)

!! (OES): nested execution of O(n)+ operator ->max could be O(n*n)+

!! (OES): inefficient addition to collection by copying within loop: payoffs := payoffs->append((payoff)) 

!! Use execute ((payoff) : payoffs) instead

! Yellow flags for operation mc_plain:

! (OEW) warning: The expression N - 1 may be independent of the iterator variables [i, Z, ST, payoff, payoffs]
! Use Extract local variable to optimise.

! Warning (OEW): The expression (_x->sqrt()) may be independent of the iterator variables [i, Z, ST, payoff, payoffs]
!  Use Extract local variable to optimise.

! Warning (OEW): The expression (lambda _x : double in (_x->sqrt())) may be independent of the iterator variables [i, Z, ST, payoff, payoffs]
!  Use Extract local variable to optimise.

! Warning (OEW): The expression (_x->exp()) may be independent of the iterator variables [i, Z, ST, payoff, payoffs]
!  Use Extract local variable to optimise.

! Warning (OEW): The expression (lambda _x : double in (_x->exp())) may be independent of the iterator variables [i, Z, ST, payoff, payoffs]
!  Use Extract local variable to optimise.

! (OEW) flaw: operator ->append copies its source, could be O(n*n) when used in loop

>> Collection operator uses in FromPython are: {1=[(payoffs)->average()], 2=[Integer.subrange(0,N - 1), Set{ST - K,0}->max(), payoffs->append((payoff))]}


>> The best data structures for operations [->average] are []
>> With overall unknown complexity


>> The best data structures for operations [->max, ->append] are [SortedSequence]
>> With overall Log: O(log n) complexity

+++ Summary of operation energy-use flaws for class FromPython: 

+++ initialise has 0 flaws: {red=0, yellow=0, amber=0}
+++ mc_plain has 11 flaws: {red=2, OEW=6, yellow=6, amber=3, OES=3, LCE=2}

++++++ Class FromPython has class-level flaws:  red  |-->   2
 amber  |-->   3
 yellow  |-->   6


++++++++++++++++++++++++++++++++++++++++++++++++++++++++


