-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathloadbalancing2.v
62 lines (48 loc) · 1.71 KB
/
loadbalancing2.v
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
51
52
53
54
55
56
57
58
59
60
61
62
Set Implicit Arguments.
Unset Strict Implicit.
Require Import QArith.
(*Avoid clash with Ssreflect*)
Delimit Scope Q_scope with coq_Qscope.
Definition Qcoq := Q.
Require Import mathcomp.ssreflect.ssreflect.
From mathcomp Require Import all_ssreflect.
From mathcomp Require Import all_algebra.
Import GRing.Theory Num.Def Num.Theory.
Require Import OUVerT.numerics combinators games compile
OUVerT.orderedtypes OUVerT.dyadic.
Require Import lightserver staging.
(** Topology:
------------ x ------------
| | -------> | Server 1 |
| Agent_i | ------------
| |
| . | 20x ------------
| . | -------> | Server 2 |
| . | ------------
| . |
| | x ------------
| Agent_k | -------> | Server 3 |
| | ------------
------------
*)
Local Open Scope ring_scope.
(*Operational type classes mean we can't forget to declare the following instances:*)
Instance r1_scalar : ScalarClass rat_realFieldType := 20%:R.
Instance r1_scalarAxiom : ScalarAxiomClass r1_scalar. Proof. by []. Qed.
(* The base type for the graph *)
Definition base :=
([finType of resource] *
scalarType scalar_val [finType of resource] *
[finType of resource])%type.
(* Each agent chooses a single server *)
Instance base_predClass : PredClass base :=
fun b =>
match b with
| (RYes,Wrap RNo,RNo) => true
| (RNo,Wrap RYes,RNo) => true
| (RNo,Wrap RNo,RYes) => true
| _ => false
end.
(*Type t wraps base in a sigma type over predicate base_predClass:*)
Definition t := [finType of {b : base | the_pred b}].
Require Import smooth.