-
Notifications
You must be signed in to change notification settings - Fork 0
/
Domain.fs
50 lines (35 loc) · 1.42 KB
/
Domain.fs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
module rec SliceMapPerformance.Domain
type DecisionType =
| Boolean
| Integer of LowerBound:float * UpperBound:float
| Continuous of LowerBound:float * UpperBound:float
type DecisionName = DecisionName of string
type Decision = {
Name : DecisionName
Type : DecisionType
} with
static member ( + ) (l: float, r: Decision) =
LinearExpr.Add (LinearExpr.Float l, LinearExpr.Decision r)
static member ( + ) (l: Decision, r: Decision) =
LinearExpr.Add (LinearExpr.Decision l, LinearExpr.Decision r)
static member ( * ) (l: float, r: Decision) =
LinearExpr.Scale (l, LinearExpr.Decision r)
static member ( * ) (l: Decision, r: float) =
LinearExpr.Scale (r, LinearExpr.Decision l)
[<RequireQualifiedAccess>]
type LinearExpr =
| Float of float
| Decision of Decision
| Scale of scale: float * expr: LinearExpr
| Add of lExpr: LinearExpr * rExpr: LinearExpr
static member ( + ) (l: float, r: LinearExpr) =
LinearExpr.Add (LinearExpr.Float l, r)
static member ( + ) (l: Decision, r: LinearExpr) =
LinearExpr.Add (LinearExpr.Decision l, r)
static member ( + ) (l: LinearExpr, r: LinearExpr) =
LinearExpr.Add (l, r)
static member ( * ) (l: float, r: LinearExpr) =
LinearExpr.Scale (l, r)
static member ( * ) (l: LinearExpr, r: float) =
LinearExpr.Scale (r, l)
static member Zero = LinearExpr.Float 0.0