Questions tagged [minimization]

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.

529 questions
4
votes
1 answer

In Sympy, what is equivalent to Mathematica's symbolic minimize function?

Mathematica has a symbolic solver for quadratic (and maybe other) functions, e.g.: Minimize[2 x^2 - y x + 5, {x}] will yield the following solution: {1/8 (40-y^2),{x->y/4}} Is this feature supported in SymPy or a derivative library? Or I have to…
tribbloid
  • 4,026
  • 14
  • 64
  • 103
4
votes
2 answers

Same optimization code different results on different computers

I am running nested optimization code. sp.optimize.minimize(fun=A, x0=D, method="SLSQP", bounds=(E), constraints=({'type':'eq','fun':constrains}), options={'disp': True, 'maxiter':100, 'ftol':1e-05}) sp.optimize.minimize(fun=B, x0=C,…
WKW
  • 77
  • 1
  • 5
4
votes
0 answers

Utilizing scipy.optimize.minimize with multiple variables of different shapes

I am curious is there is a straightforward method for utilizing scipy.optimize.minimize with multiple variables that take different shapes. For example, let's take a look at a matrix decomposition problem. I apologize, but I will be using latex here…
Grr
  • 15,553
  • 7
  • 65
  • 85
4
votes
2 answers

Minimizing Functional with Python

I have some functional, such as S[f] = \int_\Omega f^2(x) dx. If you're familiar with physics, it's the action. This object takes in a function defined on a certain domain \Omega and gives you a number. The math jargon for this is functional. Now I…
Nate Stemen
  • 1,235
  • 3
  • 15
  • 27
4
votes
1 answer

Inspect internal variables as scipy.optimize.minimize runs?

I usually inspect my variables with pdb as my program runs. Now I wish to debug my scipy.optimize.minimize by inspecting the variables as the optimization runs. result = scipy.optimize.minimize(fun, x0, method='dogleg') I tried using the callback…
Sibbs Gambling
  • 19,274
  • 42
  • 103
  • 174
4
votes
1 answer

z3 minimization and timeout

I try to use the z3 solver for a minimization problem. I was trying to get a timeout, and return the best solution so far. I use the python API, and the timeout option "smt.timeout" with set_option("smt.timeout", 1000) # 1s timeout This actually…
Emilien
  • 2,385
  • 16
  • 24
4
votes
1 answer

Fitting an ellipse through orbital data

I've generated a bunch of data for the (x,y,z) coordinates of a planet as it orbits around the Sun. Now I want to fit an ellipse through this data. What I tried to do: I created a dummy ellipse based on five parameters: The semi-major axis &…
SubTachyon
  • 43
  • 5
4
votes
1 answer

print currently evaluated params during scipy minimization

I am trying to minimize a function in Python using scipy.optimize.minimize, to determine four distinct parameters. I would like to print the currently evaluated params at each step of the optimisation algorithm, so I can use them to make my initial…
sweeeeeet
  • 1,769
  • 4
  • 26
  • 50
4
votes
3 answers

Using scipy to minimize a function that also takes non variational parameters

I want to use the scipy.optimize module to minimize a function. Let's say my function is f(x,a): def f(x,a): return a*x**2 For a fixed a, I want to minimize f(x,a) with respect to x. With scipy I can import for example the fmin function (I have an…
Miguel
  • 7,497
  • 2
  • 27
  • 46
4
votes
1 answer

How to automatically find proper initial values for fmincon?

I am trying to minimize a target function with nonlinear constrains. My problem is to conveniently find a proper initial value set for the parameters. Because the initial values must satisfy the nonlinear constrains, too, however, in my objective…
4
votes
4 answers

select a group of pairs in order to minimize rms of group

Simplified problem I have ~40 resistors (all the same value +-5%) and I need to select 12 of them so that they are as similar as possible. Solution: I list them in order and take the 12 consecutive with the smallest RMS. The actual problem I have…
muzzle
  • 315
  • 3
  • 9
4
votes
1 answer

Two dimensional Optimization (minimization) in Python (using scipy.optimize)

I am trying to optimize (minimize) a two dimensional function E(n,k) defined as follows: error=lambda x,y,w: (math.log(abs(Tformulated(x,y,w))) - math.log(abs(Tw[w])))**2 + (math.atan2(Tformulated(x,y,w).imag,Tformulated(x,y,w).real) -…
Harshad
  • 51
  • 1
  • 1
  • 4
3
votes
1 answer

Implementing additional constraints in R's nnls

I am using the R interface to the Lawson-Hanson NNLS implementation of an algorithm for non-negative linear least squares that solves ||A x - b||^2 with the constraint that all elements of vector x ≥ 0. This works fine but I would like to add…
DrSAR
  • 1,522
  • 1
  • 15
  • 36
3
votes
1 answer

What is the difference between greedy and steepest algorithms?

I have slides where 2 versions of local search algorithms are compared: greedy and steepest. Greedy: generate solution x; repeat { for each y in N(x) in random order { if f(y) > f(x) then x = y; } …
Marcin Robaszyński
  • 772
  • 1
  • 11
  • 21
3
votes
0 answers

scipy.minimize constrained optimization problem with multiple variables

I am currently trying to implement the following optimization problem in python (in order to resolve it with scipy.optimize.minimize). Please note that alpha is given,T is the number of generated random values (i.e. via Monte Carlo simulation, also…
1 2
3
35 36