M src/Charting.elm +1 -2
@@ 22,8 22,7 @@ update msg cmodel =
{ cmodel | hovering = Just hoverData, chartType = ReworkShare }
OnHoverInterrupted hoverData ->
- { cmodel | hovering = Just hoverData, chartType = InterruptedShare }
-
+ { cmodel | hovering = Just hoverData, chartType = InterruptedShare}
data =
[ { round = 101, waitingNKIT = 85, doneNKIT = 117, waitingKIT = 14, doneKIT = 188 }
M src/Field.elm +6 -18
@@ 72,22 72,18 @@ inflowToWip field =
-- nkit
-
markInterruptedProcessing : Job -> Job
-markInterruptedProcessing x =
- { x | conditions = { rework = x.conditions.rework, reqs = x.conditions.reqs, scrapped = x.conditions.scrapped, interruptedProcessing = True } }
+markInterruptedProcessing x = {x | conditions = {rework = x.conditions.rework, reqs = x.conditions.reqs, scrapped = x.conditions.scrapped, interruptedProcessing = True}}
incompleteReqsFromWipToW2 : Field -> Field
incompleteReqsFromWipToW2 field =
let
- incompletes =
- List.map markInterruptedProcessing <| List.filter (\x -> x.conditions.reqs == Incomplete) field.wip
+ incompletes = List.map markInterruptedProcessing <| List.filter (\x -> x.conditions.reqs == Incomplete) field.wip
+ completes = List.filter (\x -> x.conditions.reqs == Complete) field.wip
- completes =
- List.filter (\x -> x.conditions.reqs == Complete) field.wip
- in
- { field | w2 = field.w2 ++ incompletes, wip = completes }
+ in
+ { field | w2 = field.w2 ++ incompletes, wip = completes}
type Changeability
@@ 257,15 253,7 @@ inflowToW2OrW0 field =
applyStep : KITForNKIT -> ( FieldStep, FieldStep ) -> Model -> Model
-applyStep kitForNkit ( k, n ) model =
- let
- nkitFunction =
- if kitForNkit then
- k
-
- else
- n
- in
+applyStep kitForNkit ( k, n ) model = let nkitFunction = if kitForNkit then k else n in
case ( k, nkitFunction ) of
( Just x, Just y ) ->
{ model | kit = y model.kit, nkit = x model.nkit }
M src/Main.elm +8 -16
@@ 105,7 105,7 @@ update msg model =
else
update (NextSteps (n - 1)) <| Tuple.first <| update (NextStep model.finishRound) model
-
+
Step s ->
case s of
S0 ->
@@ 120,18 120,9 @@ update msg model =
S2 ->
-- S2 does S3
- let
- f =
- conditionalScrap model.scrapLimit >> justDoneToDone >> wipToJustDone model.round
- in
- ( chain <|
- applyStep model.kitForNkit
- ( Just f
- , Just f
- )
- model
- , Cmd.none
- )
+ let f = conditionalScrap model.scrapLimit >> justDoneToDone >> wipToJustDone model.round in
+ ( chain <| applyStep model.kitForNkit ( Just f,
+ Just f) model, Cmd.none )
-- FIXME: updatewaiting moves justDone to Done, which it shouldn't
S3 ->
@@ 202,7 193,7 @@ update msg model =
defaultToCurrentModel <| Maybe.map (\y -> applyStep model.kitForNkit ( Just <| identifyScrap y, Just <| identifyScrap y ) <| { model | scrapLimit = Just y }) <| validIntInput 0 500 x
SwapKITForNKIT ->
- ( { model | kitForNkit = not model.kitForNkit }, Cmd.none )
+ ( { model | kitForNkit = not model.kitForNkit}, Cmd.none )
SwapAutoPlay ->
( { model | autoPlay = not model.autoPlay }, Cmd.none )
@@ 448,7 439,7 @@ view model =
playInterface =
row [ spacing 10, padding 13, Font.size 12, width fill ]
- [ column [ width fill, height fill, spacing 7 ] [ autoPlayer, kitForNkit ]
+ [ column [width fill, height fill, spacing 7] [autoPlayer, kitForNkit]
, reworkProbInterface
, scrapLimitInterface
@@ 457,7 448,7 @@ view model =
kitForNkit =
row [ Font.size 12, spacing 10, width fill ]
- [ column [ spacing 5, Border.width 1, padding 5 ] [ text "KIT4NKIT", swapKITForNKITButton ]
+ [ column [ spacing 5, Border.width 1, padding 5 ] [ text "KIT4NKIT", swapKITForNKITButton]
]
autoPlayer =
@@ 465,6 456,7 @@ view model =
[ column [ spacing 5, Border.width 1, padding 5 ] [ text "AutoPlay", autoPlayButton ]
]
+
--lower =
-- row [ spacing 20, width fill, height fill ] [ viewField squareSizeUndone squareSizeDone model.nkit "NKIT", viewField squareSizeUndone squareSizeDone model.kit "KIT" ]
netWidth =
M src/Numbers.elm +2 -7
@@ 111,13 111,8 @@ decomposeNumber smaller5 xs todo =
else
decomposeNumber smaller5 (xs ++ [ addComponent ]) todoNew
-
-type alias BatchSize =
- Int
-
-
-type alias BatchCount =
- Int
+type alias BatchSize = Int
+type alias BatchCount = Int
simplifyNumber : Bool -> Int -> List ( BatchSize, BatchCount )
M src/Rework.elm +8 -22
@@ 5,7 5,6 @@ import Random
import Random.List
import Types exposing (..)
-
updateRework : Job -> ReworkCondition -> Job
updateRework j rc =
case j.conditions.rework of
@@ 24,7 23,6 @@ setRework p j =
Random.weighted ( p, NeedsRework ) [ ( 100 - p, NoRework ) ]
-
-- new setRework mechanism to improve perf with increasing no. of jobs on w0
-- aim: constant computing amount for increasing no. of jobs on w0
-- relevance: rework mechanism consumes ≈ half of computing time, which is the biggest chunk
@@ 82,13 80,9 @@ setReworks p ( kf, nkf ) =
setReworksFieldWrapper : ProbPerRound -> Field -> Random.Generator Field
-setReworksFieldWrapper p field =
- case p < 0.0001 of
- True ->
- Random.constant field
-
- False ->
- detNoOfJobsRequiringRework p (List.length field.w0) |> Random.andThen (setReworksField field)
+setReworksFieldWrapper p field = case p < 0.0001 of
+ True -> Random.constant field
+ False -> detNoOfJobsRequiringRework p (List.length field.w0) |> Random.andThen (setReworksField field)
setReworksField : Field -> Int -> Random.Generator Field
@@ 105,19 99,11 @@ setReworkNew n =
Random.map (\( a, b ) -> toRework a ++ b) << choices n
-choices : Int -> List a -> Random.Generator ( List a, List a )
-choices n xs =
- case n of
- 0 ->
- Random.constant ( [], xs )
-
- _ ->
- let
- xs1 =
- Random.List.shuffle xs
- in
- Random.map2 Tuple.pair (Random.map (List.take n) xs1) (Random.map (List.drop n) xs1)
-
+choices : Int -> List a -> Random.Generator (List a, List a)
+choices n xs = case n of
+ 0 -> Random.constant ([], xs)
+ _ -> let xs1 = Random.List.shuffle xs
+ in Random.map2 Tuple.pair (Random.map (List.take n) xs1) (Random.map (List.drop n) xs1)
setReworksCmd : Model -> Cmd Msg
setReworksCmd model =
M src/Round.elm +1 -9
@@ 43,15 43,7 @@ fieldRound f r p l field =
bothFieldsRound : KITForNKIT -> Round -> ProbPerRound -> Maybe ScrapLimit -> ( Field, Field, Stats ) -> Random.Generator ( Field, Field, Stats )
-bothFieldsRound kitForNkit r p l ( kf, nkf, stats ) =
- let
- nkitFunction =
- if kitForNkit then
- kitAfterReworks
-
- else
- nkitAfterReworks
- in
+bothFieldsRound kitForNkit r p l ( kf, nkf, stats ) = let nkitFunction = if kitForNkit then kitAfterReworks else nkitAfterReworks in
Random.map (\( a, b ) -> ( a, b, trackStats (r + 1) a b stats )) <| Random.map2 Tuple.pair (fieldRound kitAfterReworks r p l kf) (fieldRound nkitFunction r p l nkf)
M src/Stats.elm +3 -8
@@ 82,14 82,9 @@ createDataPoint r kit nkit =
safeDiv (100 * (toFloat <| List.length <| List.filter (\x -> x.conditions.rework /= NoRework) xs)) (toFloat <| List.length xs)
interruptedShare field =
- let
- totalNumber =
- List.length field.w0
-
- interrupted =
- List.length <| List.filter (\x -> x.conditions.interruptedProcessing) field.w0
- in
- (\x -> 100 * x) <| safeDiv (toFloat interrupted) (toFloat totalNumber)
+ let totalNumber = List.length field.w0
+ interrupted = List.length <| List.filter (\x -> x.conditions.interruptedProcessing) field.w0
+ in (\x -> 100 * x) <| safeDiv (toFloat interrupted) (toFloat totalNumber)
flowtimeG n xs =
safeDiv (100 * (toFloat <| List.length <| List.filter (\x -> x > n) xs)) (toFloat <| List.length xs)
M src/Types.elm +6 -13
@@ 15,10 15,8 @@ initChart : ChartType -> ChartingModel
initChart chartType =
{ hovering = Nothing, chartType = chartType }
-
chart0 : ChartingModel
-chart0 =
- initChart InterruptedShare
+chart0 = initChart InterruptedShare
chart1 : ChartingModel
@@ 45,10 43,7 @@ type AutoPlayMode
= RoundMode
| StepMode
-
-type alias KITForNKIT =
- Bool
-
+type alias KITForNKIT = Bool
type Msg
= ReceivedViewport Dom.Viewport
@@ 258,12 253,10 @@ type alias RoundParameters =
type alias NonRoundConditions =
{ rework : ReworkCondition, reqs : RequirementsCondition, scrapped : Bool, interruptedProcessing : Bool }
-
+-- = SquareFilling BorderColor Scrapped
--- = SquareFilling BorderColor Scrapped
-- toColorCombo : NonRoundConditions -> ( SquareFilling, BorderColor, Scrapped )
-
type alias Job =
{ conditions : NonRoundConditions, roundParams : RoundParameters }
@@ 280,17 273,17 @@ getIncomingRound j =
icplNew : Int -> Job
icplNew n =
- { conditions = { reqs = Incomplete, rework = NoRework, scrapped = False, interruptedProcessing = False }, roundParams = { incomingRound = n, doneRound = Nothing } }
+ { conditions = { reqs = Incomplete, rework = NoRework, scrapped = False , interruptedProcessing = False}, roundParams = { incomingRound = n, doneRound = Nothing } }
cplNew : Int -> Job
cplNew n =
- { conditions = { reqs = Complete, rework = NoRework, scrapped = False, interruptedProcessing = False }, roundParams = { incomingRound = n, doneRound = Nothing } }
+ { conditions = { reqs = Complete, rework = NoRework, scrapped = False , interruptedProcessing = False}, roundParams = { incomingRound = n, doneRound = Nothing } }
cplDone : Int -> Int -> Job
cplDone from to =
- { conditions = { reqs = Complete, rework = NoRework, scrapped = False, interruptedProcessing = False }, roundParams = { incomingRound = from, doneRound = Just to } }
+ { conditions = { reqs = Complete, rework = NoRework, scrapped = False, interruptedProcessing = False}, roundParams = { incomingRound = from, doneRound = Just to } }
icplDone : Int -> Int -> Job
M src/Views.elm +18 -42
@@ 33,12 33,10 @@ orange : Color
orange =
rgb255 255 153 0
-
yellow : Color
yellow =
rgb255 255 255 0
-
red : Color
red =
rgb255 230 74 69
@@ 120,11 118,12 @@ drawSquare : Square -> Int -> Element Ms
drawSquare sq n =
let
attrs =
- List.append [ width <| px n, height <| px n, Font.size 10, Font.center ] color
+ List.append [ width <| px n, height <| px n, Font.size 10, Font.center] color
- ( color, optionalMega ) =
+ ( color, optionalMega) =
squareToColor sq
+
content =
case optionalMega of
Nothing ->
@@ 136,28 135,21 @@ drawSquare sq n =
el attrs content
-
--squareToColor : Square -> List (Element.Attr)
squareToColor sq =
let
incompleteReqs flavor =
- [ Background.color grey, Border.width 1, Border.color flavor.borderColor, toBorderType flavor.scrapped, Font.color flavor.interruptedProcessing ]
+ [ Background.color grey, Border.width 1, Border.color flavor.borderColor, toBorderType flavor.scrapped, Font.color flavor.interruptedProcessing]
completeReqs flavor =
- [ Border.width 1, Border.color flavor.borderColor, toBorderType flavor.scrapped, Font.color flavor.interruptedProcessing ]
+ [ Border.width 1, Border.color flavor.borderColor, toBorderType flavor.scrapped, Font.color flavor.interruptedProcessing]
- reqs flavor =
- case flavor.squareFilling of
- Black ->
- incompleteReqs flavor
+ reqs flavor = case flavor.squareFilling of
+ Black -> incompleteReqs flavor -- .borderColor flavor.scrapped
+ White -> completeReqs flavor -- .borderColor flavor.scrapped
- -- .borderColor flavor.scrapped
- White ->
- completeReqs flavor
-
- -- .borderColor flavor.scrapped
optionalMega x =
case x of
Normal ->
@@ 168,12 160,11 @@ squareToColor sq =
in
case sq of
RealSquare params ->
- ( reqs params.flavor, optionalMega params.variant )
+ ( reqs params.flavor, optionalMega params.variant)
PhantomSquare ->
( [], Nothing )
-
-
+
drawLineSquares : Int -> Int -> List (Element Msg)
drawLineSquares lines perLine =
List.repeat lines (drawSquareFullN perLine)
@@ 223,7 214,7 @@ type SquareFilling
type Square
- = RealSquare { variant : SquareVariant, flavor : VisualFlavor }
+ = RealSquare {variant: SquareVariant, flavor: VisualFlavor}
| PhantomSquare
@@ 279,8 270,6 @@ drawField squareSize perRow field label
in
column [ spacing 5 ] [ fieldContent, el [ Font.size 12, Element.moveRight 5 ] <| text label ]
-
-
-- NonRoundConditions
-- { rework : ReworkCondition, reqs : RequirementsCondition, scrapped : Bool, interruptedProcessing : Bool }
-- = SquareFilling BorderColor Scrapped
@@ 319,24 308,13 @@ toBorderType scr =
False ->
Border.solid
-
toFontColor : Bool -> Color
-toFontColor x =
- if x then
- yellow
-
- else
- black
+toFontColor x = if x then yellow else black
-
-type alias VisualFlavor =
- { squareFilling : SquareFilling, borderColor : BorderColor, scrapped : Bool, interruptedProcessing : Color }
-
+type alias VisualFlavor = {squareFilling : SquareFilling, borderColor : BorderColor, scrapped : Bool, interruptedProcessing : Color}
-toVisualFlavor : NonRoundConditions -> VisualFlavor
-toVisualFlavor x =
- { squareFilling = toFillingColor x.reqs, borderColor = toBorderColor x.rework, scrapped = x.scrapped, interruptedProcessing = toFontColor x.interruptedProcessing }
-
+toVisualFlavor : NonRoundConditions -> VisualFlavor
+toVisualFlavor x = {squareFilling = toFillingColor x.reqs, borderColor = toBorderColor x.rework, scrapped = x.scrapped, interruptedProcessing = toFontColor x.interruptedProcessing}
isSet : NonRoundConditions -> Job -> Maybe Job
isSet nrc j =
@@ 357,16 335,14 @@ visibleSquares smaller5 xs =
List.map (\( x, ys ) -> ( toVisualFlavor <| .conditions x, (\z -> z + 1) <| List.length ys )) groups
perGroup ( flavor, n ) =
- List.concatMap (\( batchSize, batchCount ) -> List.repeat batchCount <| RealSquare { variant = Mega batchSize, flavor = flavor }) <| simplifyNumber smaller5 n
+ List.concatMap (\( batchSize, batchCount ) -> List.repeat batchCount <| RealSquare {variant = Mega batchSize, flavor = flavor}) <| simplifyNumber smaller5 n
in
List.concatMap perGroup counts
-
-- { rework : ReworkCondition, reqs : RequirementsCondition, scrapped : Bool, interruptedProcessing : Bool }
-- = SquareFilling BorderColor Scrapped
-
getThreeConditions : Job -> ( Scrapped, RequirementsCondition, ReworkCondition )
getThreeConditions x =
( x.conditions.scrapped, x.conditions.reqs, x.conditions.rework )
@@ 469,7 445,7 @@ viewStep im s =
stepRow 1 [ rowHead "1" "identify rework:", contentCells [ contentCell [ Background.color orange ] [ text "identify rework" ], contentCell [ Background.color blue ] [ text "identify rework" ] ] ]
step2 =
- stepRow 2 [ rowHead "2" "finish wip:", contentCells [ contentCell [] [ text "just done to done", text "wip to just done" ] ] ]
+ stepRow 2 [ rowHead "2" "finish work:", contentCells [ contentCell [] [ text "just done to done", text "worker to just done" ] ] ]
step3 =
stepRow 3 [ rowHead "3" "update waiting:", contentCells [ contentCell [] [ text "w1 to w0; w2 to w1" ] ] ]
@@ 478,7 454,7 @@ viewStep im s =
stepRow 4 [ rowHead "4" "gatekeep inflow:", contentCells [ contentCell [] [ text "N/A" ], contentCell [ Background.color blue ] [ text "blacks to wfc (w2)", text "whites to todo (w0)" ] ] ]
step5 =
- stepRow 5 [ rowHead "5" "new to wip:", contentCells [ contentCell [ Background.color orange ] [ text "inflow to worker" ], contentCell [ Background.color orange ] [ text "2 from todo (w0)" ] ] ]
+ stepRow 5 [ rowHead "5" "new to worker:", contentCells [ contentCell [ Background.color orange ] [ text "inflow to worker" ], contentCell [ Background.color orange ] [ text "2 from todo (w0)" ] ] ]
step6 =
stepRow 6 [ rowHead "6" "park incomplete:", contentCells [ contentCell [ Background.color orange ] [ text "blacks from", text "worker to wfc (w2)" ], contentCell [] [ text "N/A" ] ] ]