@@ -49,9 +49,28 @@ function free_scip(mscip::ManagedSCIP)
49
49
@assert mscip. scip[] == C_NULL
50
50
end
51
51
52
- " Set generic parameter."
53
- function set_parameter (mscip:: ManagedSCIP , name:: String , value)
54
- @SC SCIPsetParam (mscip, name, Ptr {Cvoid} (value))
52
+ " Set a parameter."
53
+ function set_parameter (mscip:: ManagedSCIP , name:: AbstractString , value)
54
+ param = SCIPgetParam (mscip, name)
55
+ if param == C_NULL
56
+ error (" Unrecognized parameter: $name " )
57
+ end
58
+ paramtype = SCIPparamGetType (param)
59
+ if paramtype === SCIP_PARAMTYPE_BOOL
60
+ @SC SCIPsetBoolParam (mscip, name, value)
61
+ elseif paramtype === SCIP_PARAMTYPE_INT
62
+ @SC SCIPsetIntParam (mscip, name, value)
63
+ elseif paramtype === SCIP_PARAMTYPE_LONGINT
64
+ @SC SCIPsetLongintParam (mscip, name, value)
65
+ elseif paramtype === SCIP_PARAMTYPE_REAL
66
+ @SC SCIPsetRealParam (mscip, name, value)
67
+ elseif paramtype === SCIP_PARAMTYPE_CHAR
68
+ @SC SCIPsetCharParam (mscip, name, value)
69
+ elseif paramtype === SCIP_PARAMTYPE_STRING
70
+ @SC SCIPsetStringParam (mscip, name, value)
71
+ else
72
+ error (" Unexpected parameter type: $paramtype " )
73
+ end
55
74
return nothing
56
75
end
57
76
0 commit comments