-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into documentation
- Loading branch information
Showing
34 changed files
with
1,276 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 0 additions & 20 deletions
20
core/src/main/scala/soda/tiles/fairness/tile/ResultPTile.soda
This file was deleted.
Oops, something went wrong.
20 changes: 0 additions & 20 deletions
20
core/src/main/scala/soda/tiles/fairness/tile/WithPTile.soda
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
...les/src/main/scala/soda/tiles/fairness/example/childcaresubsidy/CcsAcromagatInstance.soda
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
|
||
class CcsAcromagatInstance | ||
|
||
abstract | ||
actors : Seq [Actor] | ||
resources : Seq [Resource] | ||
outcome : Outcome | ||
actor_children_map : Map [Actor] [Measure] | ||
actor_adults_map : Map [Actor] [Measure] | ||
actor_income_map : Map [Actor] [Measure] | ||
resource_value_map : Map [Resource] [Measure] | ||
pipelines : Seq [String] | ||
|
||
_add_value_to (value : Int) (m : Measure) : Measure = | ||
match m | ||
case Some (other_value) ==> Some (value + other_value) | ||
case None ==> None | ||
|
||
measure_sum (a : Measure) (b : Measure) : Measure = | ||
match a | ||
case Some (value) ==> _add_value_to (value) (b) | ||
case None ==> None | ||
|
||
get_or_else [A : Type] (map : Map [A] [Measure] ) (key : A) (default : Measure) : Measure = | ||
match map .get (key) | ||
case Some (value) ==> value | ||
case None ==> default | ||
|
||
actor_children (actor : Actor) : Measure = | ||
get_or_else [Actor] (actor_children_map) (actor) (Some (-1) ) | ||
|
||
actor_adults (actor : Actor) : Measure = | ||
get_or_else [Actor] (actor_adults_map) (actor) (Some (-1) ) | ||
|
||
actor_income (actor : Actor) : Measure = | ||
get_or_else [Actor] (actor_income_map) (actor) (Some (-1) ) | ||
|
||
resource_value (resource : Resource) : Measure = | ||
get_or_else [Resource] (resource_value_map) (resource) (Some (-1) ) | ||
|
||
context = "ChildCareSubsidy" | ||
|
||
initial_message : TileMessage [Boolean] = | ||
TileMessageBuilder .mk .build (context) (outcome) (true) | ||
|
||
end | ||
|
113 changes: 113 additions & 0 deletions
113
.../main/scala/soda/tiles/fairness/example/childcaresubsidy/CcsAcromagatInstanceBuilder.soda
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
|
||
class CcsAcromagatInstanceBuilder | ||
|
||
abstract | ||
|
||
import | ||
soda.tiles.fairness.example.parser.YamlParser | ||
java.io.BufferedReader | ||
java.io.Reader | ||
|
||
actors_key = "actors" | ||
|
||
resources_key = "resources" | ||
|
||
outcome_key = "outcome" | ||
|
||
actor_children_key = "actor_children" | ||
|
||
actor_adults_key = "actor_adults" | ||
|
||
actor_income_key = "actor_income" | ||
|
||
resource_value_key = "resource_value" | ||
|
||
pipelines_key = "pipelines" | ||
|
||
to_measure (s : String) : Measure = | ||
s .toIntOption | ||
|
||
_get_actors (m : Map [String] [Seq [Tuple2 [String] [String] ] ] ) | ||
: Seq [Actor] = | ||
m .getOrElse (actors_key , None) | ||
.iterator | ||
.map (lambda pair --> pair ._1) | ||
.toSeq | ||
|
||
_get_resources (m : Map [String] [Seq [Tuple2 [String] [String] ] ] ) | ||
: Seq [Resource] = | ||
m .getOrElse (resources_key , None) | ||
.iterator | ||
.map (lambda pair --> pair ._1) | ||
.toSeq | ||
|
||
_get_outcome (m : Map [String] [Seq [Tuple2 [String] [String] ] ] ) | ||
: Outcome = | ||
Outcome .mk ( | ||
m .getOrElse (outcome_key , None) | ||
.iterator | ||
.map(lambda pair --> Assignment .mk (pair._1) (pair ._2) ) | ||
.toSeq | ||
) | ||
|
||
_get_actor_children_map (m : Map [String] [Seq [Tuple2 [String] [String] ] ] ) | ||
: Map [Actor] [Measure] = | ||
m .getOrElse (actor_children_key , None) | ||
.iterator | ||
.map (lambda pair --> Tuple2 (pair ._1 , to_measure (pair ._2) ) ) | ||
.toMap | ||
|
||
_get_actor_adults_map (m : Map [String] [Seq [Tuple2 [String] [String] ] ] ) | ||
: Map [Actor] [Measure] = | ||
m .getOrElse (actor_adults_key , None) | ||
.iterator | ||
.map (lambda pair --> Tuple2 (pair ._1 , to_measure (pair ._2) ) ) | ||
.toMap | ||
|
||
_get_actor_income_map (m : Map [String] [Seq [Tuple2 [String] [String] ] ] ) | ||
: Map [Actor] [Measure] = | ||
m .getOrElse (actor_income_key , None) | ||
.iterator | ||
.map (lambda pair --> Tuple2 (pair ._1 , to_measure (pair ._2) ) ) | ||
.toMap | ||
|
||
_get_resource_value_map (m : Map [String] [Seq [Tuple2 [String] [String] ] ] ) | ||
: Map [Resource] [Measure] = | ||
m .getOrElse (resource_value_key , None) | ||
.iterator | ||
.map (lambda pair --> Tuple2 (pair ._1 , to_measure (pair ._2) ) ) | ||
.toMap | ||
|
||
_get_pipelines (m : Map [String] [Seq [Tuple2 [String] [String] ] ] ) | ||
: Seq [String] = | ||
m .getOrElse (pipelines_key , None) | ||
.iterator | ||
.map (lambda pair --> pair ._1) | ||
.toSeq | ||
|
||
_build_from_map (m : Map [String] [Seq [Tuple2 [String] [String] ] ] ) | ||
: Option [CcsAcromagatInstance] = | ||
Some ( | ||
CcsAcromagatInstance .mk ( | ||
_get_actors (m) ) ( | ||
_get_resources (m) ) ( | ||
_get_outcome (m) ) ( | ||
_get_actor_children_map (m) ) ( | ||
_get_actor_adults_map (m) ) ( | ||
_get_actor_income_map (m) ) ( | ||
_get_resource_value_map (m) ) ( | ||
_get_pipelines (m) | ||
) | ||
) | ||
|
||
build (s : Seq [Seq [Tuple2 [String] [Seq [Tuple2 [String] [String] ] ] ] ] ) | ||
: Option [CcsAcromagatInstance] = | ||
match s | ||
case a +: as ==> _build_from_map (a .toMap) | ||
case otherwise ==> None | ||
|
||
from_yaml (reader : Reader) : Option [CcsAcromagatInstance] = | ||
build (YamlParser .mk .parse (reader) ) | ||
|
||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.