diff --git a/src/managed_scip.jl b/src/managed_scip.jl index 0b56f99e..05cf3f03 100644 --- a/src/managed_scip.jl +++ b/src/managed_scip.jl @@ -286,8 +286,7 @@ function add_nonlinear_constraint(mscip::ManagedSCIP, operators::Vector{SCIP_Exp elseif op == SCIP_EXPR_REALPOWER nchildren == 2 || error("Need two children for op. $(op)!") base = exprs[children[offsets[i]]] - exponent_expr = children[offsets[i] + 1] # is SCIP_EXPR_CONST, - exponent = values[children[offsets[exponent_expr]]] # directly get value + exponent = values[children[offsets[i] + 1]] @SC SCIPexprCreate(SCIPblkmem(mscip), expr__, op, base, exponent) elseif op == SCIP_EXPR_DIV nchildren == 2 || error("Need two children for op. $(op)!") diff --git a/test/managed_scip.jl b/test/managed_scip.jl index 0f8f9fff..0bad2b47 100644 --- a/test/managed_scip.jl +++ b/test/managed_scip.jl @@ -33,10 +33,10 @@ end # abspower: y == sign(x) * |x|^2 ( == x * |x| ) a = SCIP.add_abspower_constraint(mscip, x, 0.0, 2.0, y, -1.0, 0.0, 0.0) # nonlinear: x^0.2 == 1 - _operators = [SCIP.SCIP_EXPR_VARIDX, SCIP.SCIP_EXPR_CONST, SCIP.SCIP_EXPR_REALPOWER] - _offsets = [1, 2, 3, 5] - _children = [x.val, 1, 1, 2] # extract integer from VarRef! - _values = [ 0.2] + _operators = [SCIP.SCIP_EXPR_VARIDX, SCIP.SCIP_EXPR_REALPOWER] + _offsets = [1, 2, 4] + _children = [x.val, 1, 1] # extract integer from VarRef! + _values = [0.2] n = SCIP.add_nonlinear_constraint(mscip, _operators, _offsets, _children, _values, 1.0, 1.0)