Minimization is a subclass of mathematical optimization where given a cost or objective function, the goal is to choose the best set of parameters that will minimize the value given by this function.
Questions tagged [minimization]
529 questions
3
votes
1 answer
nlm with multiple variables in R
I am trying to use nlm() to minimize the SSE in a function. I'm having trouble with they syntax and getting nlm() to provide estimates for both variables. Eventually t_1, t_2, and t_3 will be values pulled from a data.frame but I just assigned them…

vb66
- 353
- 3
- 14
3
votes
2 answers
How to fix 'The array returned by a function changed size between calls' while using lmfit for minimization?
How can I fix code with error 'The array returned by a function changed size between calls' while using lmfit for minimization?
Please find my code below:
import numpy as np
import pandas as pd
import lmfit as lf
#model needs to be fitted
x0 =…

Ankita Bera
- 35
- 2
- 6
3
votes
2 answers
Use Tensorflow/PyTorch to speed up minimisation of a custom function
I do a lot of simulations, for which I often need to minimise complicated user-defined functions, for which I generally use numpy and scipy.optimize.minimize(). However, the problem with this is that I need to explicitly write down a gradient…

ap21
- 2,372
- 3
- 16
- 32
3
votes
2 answers
Is there a python implementation of a basis pursuit solver?
Originally, I wanted to use the YALL1 package for L1 minimization, however, it's written in matlab. After some research I couldn't find a basis pursuit solver in Python but is there one out there? Alternatively, which existing libraries can I use to…

Rani
- 483
- 7
- 17
3
votes
1 answer
how to store the output of Minimization
I minimize a multivariable function in Mathematica using Minimization. It works fine. I want to pass the output of the Minimization to variables in order to use them ahead. But I am missing something. Let's see it (the Etet function is defined…

geom
- 195
- 8
3
votes
0 answers
Multiple variables and arguments in SciPy's optimize.fmin
I wish to use scipy's optimize.fmin function to find the minimum of a function, which is a function of both variables I wish to minimize over and parameters which do not change (are not optimized over).
I am able to do this when optimizing over a…

amquack
- 837
- 10
- 24
3
votes
1 answer
Constraints seem to be ignored using basinhopping with COBYLA method
I'm having trouble specifying constraints using basinhopping with method='COBYLA'. Here is a test case where things go wrong. Essentially, the constraints are ignored and there are function trials outside the specified range. I specify a simple…

andrea m.
- 668
- 7
- 15
3
votes
1 answer
Scipy minimize ignores constraint
I have the following code:
def constraint(params):
if abs(params[0] - 15) < 2 and abs(params[1] + 10) < 2:
return -1
else:
return 0
def f(params):
x, z = params
if abs(x - 15) < 2 and abs(z + 10) < 2:
return…

artem
- 16,382
- 34
- 113
- 189
3
votes
1 answer
Dynamically fixing some variables when using fmincon
I have a MINLP objective function and I want to fix some variables value into constant as an example described below:
A = [1 1 1];
b = 30;
x1 = zeros(1,3);
y=1;
x = fmincon(@(x)objfun(x,y),x1,A,b);
function f = objfun(x,y)
x(y) = 1;
f = x(1)^2 +…

bnbfreak
- 353
- 3
- 14
3
votes
1 answer
How can I optimize a two variable function
I have been trying to optimize the following function, but without success:
parametros <- data.frame(ap=c(11.1, 7.07, 6.3, 4.75, 4, 3.35),
fx=c(41.2012, 39.3732, 25.2912, 10.3455, 1.2253, 0.4017))
xm <- 11.2
fxcalc <-…

Rodrigo Guinea
- 328
- 4
- 16
3
votes
1 answer
fmincon with lower bound fails, even though solution is at initial point
I'm trying to minimize a non-linear objective function (my actual function is much more complicated than that, but I found that even this simple function illustrates the point), where I know that minimum is obtained at the initial point x0:
fun =…

bonifaz
- 588
- 3
- 16
3
votes
1 answer
Matlab Curve Fitting via Optimization
I have tried to follow this tutorial to fit a curve to my dataset. The equation for the curve should be
f(t) = log10((wpmcoeff./(t.^2)) +
((1.038+3.*log(2.*pi.*1e6.*t)).*fpmcoeff./(t.^2))+(wfmcoeff./t) +
…

Bethany Baxter
- 31
- 4
3
votes
2 answers
Scipy selects nan as inputs while minimizing
I have this objective function (in python) :
actions= [...] # some array
Na= len(actions)
# maximize p0 * qr(s,a0,b0) + ... + pn * qr(s,an,bn)
def objective(x):
p = x[:Na] # p is a probability distribution
b = x[Na:2 * Na] # b is…

mehh
- 59
- 1
- 9
3
votes
1 answer
Minimize error in homography matrix
I have a homgraphy matrix
[h1 h2 h3
h4 h5 h6
h7 h8 h9]
I have transformed a point
p1 to P1 using above homography matrix.
Similarly
p2 to P2
p3 to P3
p4 to P4
I know the diffence between
P1-P2 = D1
P2-P3 = D2
P3-P4 = D3
Due to…

Deepak
- 1,038
- 5
- 17
- 44
3
votes
1 answer
Optimization algorithm (dog-leg trust-region) in Matlab and Python
I'm trying to solve a set of nonlinear equations using the dog-leg trust-region algorithm in Matlab and Python.
In Matlab there is fsolve where this algorithm is the default, whereas for Python we specify 'dogleg' in scipy.optimize.minimize. I won't…

Medulla Oblongata
- 3,771
- 8
- 36
- 75