@@ -159,14 +159,15 @@ end
159159 _to_string (x) = GC. @preserve (x, unsafe_string (pointer (x)))
160160 @test _to_string (tmp) == " xtol"
161161 KN_get_param_doc (kc, KN_PARAM_XTOL, tmp, 1024 )
162+ header = KNITRO. knitro_version () >= v " 15" ? " " : " # "
162163 @test _to_string (tmp) ==
163- " # Step size tolerance used for terminating the optimization.\n "
164+ " $(header) Step size tolerance used for terminating the optimization.\n "
164165 KN_get_param_type (kc, KN_PARAM_XTOL, pCint)
165166 @test pCint[] == KN_PARAMTYPE_FLOAT
166167 KN_get_num_param_values (kc, KN_PARAM_XTOL, pCint)
167168 @test pCint[] == 0
168169 KN_get_param_value_doc (kc, KN_PARAM_GRADOPT, 1 , tmp, 1024 )
169- @test _to_string (tmp) == " exact"
170+ @test occursin ( " exact" , _to_string (tmp))
170171 KN_get_param_id (kc, " xtol" , pCint)
171172 @test pCint[] == KN_PARAM_XTOL
172173
@@ -276,20 +277,20 @@ end
276277 @test pCint[] >= 0
277278 pCdouble = Ref {Cdouble} ()
278279 KN_get_abs_feas_error (kc, pCdouble)
279- @test pCdouble[] < 1e-10
280+ @test pCdouble[] < 1e-6
280281 KN_get_rel_feas_error (kc, pCdouble)
281- @test pCdouble[] < 1e-10
282+ @test pCdouble[] < 1e-6
282283 KN_get_abs_opt_error (kc, pCdouble)
283- @test pCdouble[] < 1e-7
284+ @test pCdouble[] < 1e-4
284285 KN_get_rel_opt_error (kc, pCdouble)
285- @test pCdouble[] < 1e-8
286+ @test pCdouble[] < 1e-6
286287 KN_get_con_value (kc, 0 , pCdouble)
287- @test pCdouble[] ≈ 3.96
288+ @test ≈ ( pCdouble[], 3.96 ; atol = 1e-4 )
288289 nStatus, objSol, x, lambda_ = KN_get_solution (kc)
289290 @test nStatus == 0
290- @test x ≈ [0.0 , 2.0 , 1.98 ]
291+ @test ≈ (x, [0.0 , 2.0 , 1.98 ]; atol = 1e-4 )
291292
292- @test objSol ≈ 31.363199 atol = 1e-5
293+ @test objSol ≈ 31.363 atol = 1e-3
293294
294295 # Test getters for primal and dual variables
295296 if KNITRO. knitro_version () >= v " 12.0"
499500 KN_set_obj_name (kc, " myobj" )
500501 # Set feasibility tolerances
501502 KN_set_var_feastols_all (kc, [0.1 , 0.001 , 0.1 ])
502- KN_set_con_feastols_all (kc, [0.1 ])
503+ KN_set_con_feastols_all (kc, [1e-4 ])
503504 KN_set_compcon_feastols_all (kc, [0.1 ])
504505 # Set finite differences step size
505506 KN_set_cb_relstepsizes_all (kc, cb, [0.1 , 0.001 , 0.1 ])
880881 for x in xIndices
881882 KN_set_var_primal_init_value (kc, x, 0.8 )
882883 end
883-
884+ KN_set_var_lobnd (kc, 2 , 0.0 )
884885 # Add the constraints and set the rhs and coefficients
885886 KN_add_cons (kc, 3 , zeros (Cint, 3 ))
886887 KN_set_con_eqbnds_all (kc, [1.0 , 0.0 , 0.0 ])
0 commit comments