@@ -23,6 +23,7 @@ module E = struct
23
23
| PREPRO of bool option
24
24
| SOLVERALLOWSUBOPTIMAL of bool option
25
25
| SOLVERTIMEOUT of float option
26
+ | SOLVERTOLERANCE of float option
26
27
| UPGRADECRITERIA of string option
27
28
| USEINTERNALSOLVER of bool option
28
29
| VERSIONLAGPOWER of int option
@@ -42,6 +43,7 @@ module E = struct
42
43
let solverallowsuboptimal =
43
44
value (function SOLVERALLOWSUBOPTIMAL b -> b | _ -> None )
44
45
let solvertimeout = value (function SOLVERTIMEOUT f -> f | _ -> None )
46
+ let solvertolerance = value (function SOLVERTOLERANCE f -> f | _ -> None )
45
47
let useinternalsolver = value (function USEINTERNALSOLVER b -> b | _ -> None )
46
48
let upgradecriteria = value (function UPGRADECRITERIA s -> s | _ -> None )
47
49
let versionlagpower = value (function VERSIONLAGPOWER i -> i | _ -> None )
@@ -59,6 +61,7 @@ type t = {
59
61
solver_preferences_fixup : string option Lazy .t ;
60
62
solver_preferences_best_effort_prefix : string option Lazy .t ;
61
63
solver_timeout : float option ;
64
+ solver_tolerance : float option ;
62
65
solver_allow_suboptimal : bool ;
63
66
cudf_trim : string option ;
64
67
dig_depth : int ;
@@ -75,6 +78,7 @@ type 'a options_fun =
75
78
?solver_preferences_fixup:string option Lazy .t ->
76
79
?solver_preferences_best_effort_prefix:string option Lazy .t ->
77
80
?solver_timeout:float option ->
81
+ ?solver_tolerance:float option ->
78
82
?solver_allow_suboptimal:bool ->
79
83
?cudf_trim:string option ->
80
84
?dig_depth:int ->
@@ -95,6 +99,7 @@ let default =
95
99
solver_preferences_fixup = lazy None ;
96
100
solver_preferences_best_effort_prefix = lazy None ;
97
101
solver_timeout = Some 60. ;
102
+ solver_tolerance = Some 0.0 ;
98
103
solver_allow_suboptimal = true ;
99
104
cudf_trim = None ;
100
105
dig_depth = 2 ;
@@ -111,6 +116,7 @@ let setk k t
111
116
?solver_preferences_fixup
112
117
?solver_preferences_best_effort_prefix
113
118
?solver_timeout
119
+ ?solver_tolerance
114
120
?solver_allow_suboptimal
115
121
?cudf_trim
116
122
?dig_depth
@@ -133,6 +139,8 @@ let setk k t
133
139
solver_preferences_best_effort_prefix;
134
140
solver_timeout =
135
141
t.solver_timeout + solver_timeout;
142
+ solver_tolerance =
143
+ t.solver_tolerance + solver_tolerance;
136
144
solver_allow_suboptimal =
137
145
t.solver_allow_suboptimal + solver_allow_suboptimal;
138
146
cudf_trim = t.cudf_trim + cudf_trim;
@@ -193,6 +201,8 @@ let initk k =
193
201
E. besteffortprefixcriteria () >> | fun c -> (lazy (Some c)) in
194
202
let solver_timeout =
195
203
E. solvertimeout () >> | fun f -> if f < = 0. then None else Some f in
204
+ let solver_tolerance =
205
+ E. solvertolerance () >> | fun f -> if f < = 0. then None else Some f in
196
206
setk (setk (fun c -> r := with_auto_criteria c; k)) ! r
197
207
~cudf_file: (E. cudffile () )
198
208
~solver
@@ -202,6 +212,7 @@ let initk k =
202
212
?solver_preferences_fixup:fixup_criteria
203
213
?solver_preferences_best_effort_prefix:best_effort_prefix_criteria
204
214
?solver_timeout
215
+ ?solver_tolerance
205
216
?solver_allow_suboptimal:(E. solverallowsuboptimal () )
206
217
~cudf_trim: (E. cudftrim () )
207
218
?dig_depth:(E. digdepth () )
@@ -253,6 +264,6 @@ let call_solver ~criteria cudf =
253
264
OpamConsole. log " SOLVER" " Calling solver %s with criteria %s"
254
265
(OpamCudfSolver. get_name (module S )) criteria;
255
266
let chrono = OpamConsole. timer () in
256
- let r = S. call ~criteria ?timeout:(! r.solver_timeout) cudf in
267
+ let r = S. call ~criteria ?timeout:(! r.solver_timeout) ?tolerance:( ! r.solver_tolerance) cudf in
257
268
OpamConsole. log " SOLVER" " External solver took %.3fs" (chrono () );
258
269
r
0 commit comments