package lp-glpk

  1. Overview
  2. Docs

Source file g.ml

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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
[@@@warning "-9-27"]
include Ctypes
let lift x = x
open Ctypes_static

let rec field : type t a. t typ -> string -> a typ -> (a, t) field =
  fun s fname ftype -> match s, fname with
  | Struct ({ tag = "iocp"; _} as s'), "flip" ->
    let f = {ftype; fname; foffset = 140} in 
    (s'.fields <- BoxedField f :: s'.fields; f)
  | Struct ({ tag = "iocp"; _} as s'), "alien" ->
    let f = {ftype; fname; foffset = 136} in 
    (s'.fields <- BoxedField f :: s'.fields; f)
  | Struct ({ tag = "iocp"; _} as s'), "save_sol" ->
    let f = {ftype; fname; foffset = 128} in 
    (s'.fields <- BoxedField f :: s'.fields; f)
  | Struct ({ tag = "iocp"; _} as s'), "use_sol" ->
    let f = {ftype; fname; foffset = 120} in 
    (s'.fields <- BoxedField f :: s'.fields; f)
  | Struct ({ tag = "iocp"; _} as s'), "sr_heur" ->
    let f = {ftype; fname; foffset = 116} in 
    (s'.fields <- BoxedField f :: s'.fields; f)
  | Struct ({ tag = "iocp"; _} as s'), "ps_tm_lim" ->
    let f = {ftype; fname; foffset = 112} in 
    (s'.fields <- BoxedField f :: s'.fields; f)
  | Struct ({ tag = "iocp"; _} as s'), "ps_heur" ->
    let f = {ftype; fname; foffset = 108} in 
    (s'.fields <- BoxedField f :: s'.fields; f)
  | Struct ({ tag = "iocp"; _} as s'), "fp_heur" ->
    let f = {ftype; fname; foffset = 104} in 
    (s'.fields <- BoxedField f :: s'.fields; f)
  | Struct ({ tag = "iocp"; _} as s'), "binarize" ->
    let f = {ftype; fname; foffset = 100} in 
    (s'.fields <- BoxedField f :: s'.fields; f)
  | Struct ({ tag = "iocp"; _} as s'), "presolve" ->
    let f = {ftype; fname; foffset = 96} in 
    (s'.fields <- BoxedField f :: s'.fields; f)
  | Struct ({ tag = "iocp"; _} as s'), "clq_cuts" ->
    let f = {ftype; fname; foffset = 92} in 
    (s'.fields <- BoxedField f :: s'.fields; f)
  | Struct ({ tag = "iocp"; _} as s'), "cov_cuts" ->
    let f = {ftype; fname; foffset = 88} in 
    (s'.fields <- BoxedField f :: s'.fields; f)
  | Struct ({ tag = "iocp"; _} as s'), "gmi_cuts" ->
    let f = {ftype; fname; foffset = 84} in 
    (s'.fields <- BoxedField f :: s'.fields; f)
  | Struct ({ tag = "iocp"; _} as s'), "mir_cuts" ->
    let f = {ftype; fname; foffset = 80} in 
    (s'.fields <- BoxedField f :: s'.fields; f)
  | Struct ({ tag = "iocp"; _} as s'), "mip_gap" ->
    let f = {ftype; fname; foffset = 72} in 
    (s'.fields <- BoxedField f :: s'.fields; f)
  | Struct ({ tag = "iocp"; _} as s'), "pp_tech" ->
    let f = {ftype; fname; foffset = 68} in 
    (s'.fields <- BoxedField f :: s'.fields; f)
  | Struct ({ tag = "iocp"; _} as s'), "cb_size" ->
    let f = {ftype; fname; foffset = 64} in 
    (s'.fields <- BoxedField f :: s'.fields; f)
  | Struct ({ tag = "iocp"; _} as s'), "cb_info" ->
    let f = {ftype; fname; foffset = 56} in 
    (s'.fields <- BoxedField f :: s'.fields; f)
  | Struct ({ tag = "iocp"; _} as s'), "cb_func" ->
    let f = {ftype; fname; foffset = 48} in 
    (s'.fields <- BoxedField f :: s'.fields; f)
  | Struct ({ tag = "iocp"; _} as s'), "out_dly" ->
    let f = {ftype; fname; foffset = 40} in 
    (s'.fields <- BoxedField f :: s'.fields; f)
  | Struct ({ tag = "iocp"; _} as s'), "out_frq" ->
    let f = {ftype; fname; foffset = 36} in 
    (s'.fields <- BoxedField f :: s'.fields; f)
  | Struct ({ tag = "iocp"; _} as s'), "tm_lim" ->
    let f = {ftype; fname; foffset = 32} in 
    (s'.fields <- BoxedField f :: s'.fields; f)
  | Struct ({ tag = "iocp"; _} as s'), "tol_obj" ->
    let f = {ftype; fname; foffset = 24} in 
    (s'.fields <- BoxedField f :: s'.fields; f)
  | Struct ({ tag = "iocp"; _} as s'), "tol_int" ->
    let f = {ftype; fname; foffset = 16} in 
    (s'.fields <- BoxedField f :: s'.fields; f)
  | Struct ({ tag = "iocp"; _} as s'), "bt_tech" ->
    let f = {ftype; fname; foffset = 8} in 
    (s'.fields <- BoxedField f :: s'.fields; f)
  | Struct ({ tag = "iocp"; _} as s'), "br_tech" ->
    let f = {ftype; fname; foffset = 4} in 
    (s'.fields <- BoxedField f :: s'.fields; f)
  | Struct ({ tag = "iocp"; _} as s'), "msg_lev" ->
    let f = {ftype; fname; foffset = 0} in 
    (s'.fields <- BoxedField f :: s'.fields; f)
  | Struct ({ tag = "smcp"; _} as s'), "aorn" ->
    let f = {ftype; fname; foffset = 84} in 
    (s'.fields <- BoxedField f :: s'.fields; f)
  | Struct ({ tag = "smcp"; _} as s'), "shift" ->
    let f = {ftype; fname; foffset = 80} in 
    (s'.fields <- BoxedField f :: s'.fields; f)
  | Struct ({ tag = "smcp"; _} as s'), "excl" ->
    let f = {ftype; fname; foffset = 76} in 
    (s'.fields <- BoxedField f :: s'.fields; f)
  | Struct ({ tag = "smcp"; _} as s'), "presolve" ->
    let f = {ftype; fname; foffset = 72} in 
    (s'.fields <- BoxedField f :: s'.fields; f)
  | Struct ({ tag = "smcp"; _} as s'), "out_dly" ->
    let f = {ftype; fname; foffset = 68} in 
    (s'.fields <- BoxedField f :: s'.fields; f)
  | Struct ({ tag = "smcp"; _} as s'), "out_frq" ->
    let f = {ftype; fname; foffset = 64} in 
    (s'.fields <- BoxedField f :: s'.fields; f)
  | Struct ({ tag = "smcp"; _} as s'), "tm_lim" ->
    let f = {ftype; fname; foffset = 60} in 
    (s'.fields <- BoxedField f :: s'.fields; f)
  | Struct ({ tag = "smcp"; _} as s'), "it_lim" ->
    let f = {ftype; fname; foffset = 56} in 
    (s'.fields <- BoxedField f :: s'.fields; f)
  | Struct ({ tag = "smcp"; _} as s'), "obj_ul" ->
    let f = {ftype; fname; foffset = 48} in 
    (s'.fields <- BoxedField f :: s'.fields; f)
  | Struct ({ tag = "smcp"; _} as s'), "obj_ll" ->
    let f = {ftype; fname; foffset = 40} in 
    (s'.fields <- BoxedField f :: s'.fields; f)
  | Struct ({ tag = "smcp"; _} as s'), "tol_piv" ->
    let f = {ftype; fname; foffset = 32} in 
    (s'.fields <- BoxedField f :: s'.fields; f)
  | Struct ({ tag = "smcp"; _} as s'), "tol_dj" ->
    let f = {ftype; fname; foffset = 24} in 
    (s'.fields <- BoxedField f :: s'.fields; f)
  | Struct ({ tag = "smcp"; _} as s'), "tol_bnd" ->
    let f = {ftype; fname; foffset = 16} in 
    (s'.fields <- BoxedField f :: s'.fields; f)
  | Struct ({ tag = "smcp"; _} as s'), "r_test" ->
    let f = {ftype; fname; foffset = 12} in 
    (s'.fields <- BoxedField f :: s'.fields; f)
  | Struct ({ tag = "smcp"; _} as s'), "pricing" ->
    let f = {ftype; fname; foffset = 8} in 
    (s'.fields <- BoxedField f :: s'.fields; f)
  | Struct ({ tag = "smcp"; _} as s'), "meth" ->
    let f = {ftype; fname; foffset = 4} in 
    (s'.fields <- BoxedField f :: s'.fields; f)
  | Struct ({ tag = "smcp"; _} as s'), "msg_lev" ->
    let f = {ftype; fname; foffset = 0} in 
    (s'.fields <- BoxedField f :: s'.fields; f)
  | View { ty; _ }, _ ->
    let { ftype; foffset; fname } = field ty fname ftype in
    { ftype; foffset; fname }
  | _ -> failwith ("Unexpected field "^ fname)

let rec seal : type a. a typ -> unit = function
  | Struct ({ tag = "iocp"; spec = Incomplete _; _ } as s') ->
    s'.spec <- Complete { size = 328; align = 8 }
  | Struct ({ tag = "smcp"; spec = Incomplete _; _ } as s') ->
    s'.spec <- Complete { size = 352; align = 8 }
  | Struct { tag; spec = Complete _; _ } ->
    raise (ModifyingSealedType tag)
  | Union { utag; uspec = Some _; _ } ->
    raise (ModifyingSealedType utag)
  | View { ty; _ } -> seal ty
  | _ ->
    raise (Unsupported "Sealing a non-structured type")

type 'a const = 'a
let constant (type t) name (t : t typ) : t = match t, name with
  | _, s -> failwith ("unmatched constant: "^ s)

let enum (type a) name ?typedef ?unexpected (alist : (a * int64) list) =
  match name with
  | s ->
    failwith ("unmatched enum: "^ s)
OCaml

Innovation. Community. Security.