Just for fun, a small demo in julia (as someone said: no concrete solution available).
This a global open-source solver which will work on small-scale problems like that (and transfers to more complex ones). Keep in mind, that your examples are somewhat trivial (both targets will result in lower-bounds for all variables, no optimization needed to see that; the code will output those as expected) and i'm using some other value where there actually is something to optimize!
When the model get's more complex, global-optimization will be infeasible (very hard in theory; sometimes impossible). You can just switch the solver to Ipopt to obtain a local-optimum.
This can be done too in python using pyomo, but it's less nice. The model and the solver can be used. Only the code changes.
Code
using JuMP, AmplNLWriter
TARGET = 387
m = Model(solver=AmplNLSolver(CoinOptServices.couenne))
@variable(m, 10 <= param1 <= 20, start=10)
@variable(m, 20 <= param2 <= 30, start=20)
@variable(m, 30 <= param3 <= 40, start=30)
@variable(m, 40 <= param4 <= 50, start=40)
@variable(m, aux)
@NLconstraint(m, aux == TARGET - (param1 + 3*param2 + 5*param3 + 5^3 + sqrt(param4)))
@NLobjective(m, Min, aux^2)
solve(m)
println("objective: ", getobjectivevalue(m))
println("param1 = ", getvalue(param1))
println("param2 = ", getvalue(param2))
println("param3 = ", getvalue(param3))
println("param4 = ", getvalue(param4))
Out
Mailing list: couenne@list.coin-or.org
Instructions: http://www.coin-or.org/Couenne
couenne:
ANALYSIS TEST: Couenne: new cutoff value 0.0000000000e+000 (0.016 seconds)
NLP0012I
Num Status Obj It time Location
NLP0014I 1 OPT 0 7 0.003
Loaded instance "C:\Users\Sascha\.julia\v0.5\AmplNLWriter\.solverdata\jl_21AE.tmp.nl"
Constraints: 1
Variables: 5 (0 integer)
Auxiliaries: 2 (0 integer)
Coin0506I Presolve 11 (0) rows, 4 (-3) columns and 22 (-3) elements
Clp0006I 0 Obj 0 Primal inf 0.0023740886 (2)
Clp0006I 1 Obj -4.0767235e-022
Clp0000I Optimal - objective value 0
Clp0032I Optimal objective 0 - 1 iterations time 0.012, Presolve 0.00
Clp0000I Optimal - objective value 0
NLP Heuristic: NLP0014I 2 OPT 0 3 0.001
no solution.
Cbc0010I After 0 nodes, 0 on tree, 1e+050 best solution, best possible 0 (0.01 seconds)
Clp0000I Optimal - objective value 3.90625e-007
Clp0006I 0 Obj 0 Primal inf 0.00098181331 (1)
Clp0006I 1 Obj -3.2730444e-022
Clp0000I Optimal - objective value 0
Optimality Based BT: 0 improved bounds
Cbc0004I Integer solution of 0 found after 2 iterations and 2 nodes (0.03 seconds)
Cbc0001I Search completed - best objective 0, took 2 iterations and 2 nodes (0.04 seconds)
Cbc0035I Maximum depth 0, 0 variables fixed on reduced cost
"Finished"
Linearization cuts added at root node: 11
Linearization cuts added in total: 11 (separation time: 0s)
Total solve time: 0.065s (0.065s in branch-and-bound)
Lower bound: 0
Upper bound: 0 (gap: 0.00%)
Branch-and-bound nodes: 2
WARNING: Nonlinear solver does not provide dual solutions
objective: 0.0
param1 = 10.0
param2 = 20.0
param3 = 37.13508893593264
param4 = 40.0