Questions tagged [scipy-optimize-minimize]

446 questions
0
votes
1 answer

Minimizing a list of parameters using 'scipy.optimize.minimize' instead of individual parameters

I am looking for a way to fit a pseudovoigt synthetic profile to an observed spectral profile. The general approach is that there are theoretical lines at given wavelengths that contribute to the profile. In the case of multiple overlapping…
Marko
  • 71
  • 3
0
votes
0 answers

unpaking with * operator in Numba

Im trying to run a code like this, from numba import njit @njit def fun(x): one,*two = x print(two) fun([1,2,3]) But, when I tried to run , it give me the following error mesage: UnsupportedError: Use of unsupported opcode (UNPACK_EX)…
Eimin
  • 1
0
votes
1 answer

Doesn't respect limit conditions in scipy.optimize

Nonlinear Programming with Inequality Constraints ============== Imagine that you work out in a factory that produces some kind of composite products. Each product has its own composition of parts. Some parts are bought, and some are made at your…
0
votes
0 answers

Optimal transport for large source and destination nodes Scipy linear program

I want to solve an optimal transport for source and destination nodes of sizes 42000 and 18000 respectively. I know that Scipy Linear Programming Module now includes HIGHS so it should be pretty efficient to use. However, I have been running the…
0
votes
1 answer

Scipy.optimize violating/not respecting constraint

The problem definition is as follows: Objective function: maximize Z = 45x1 + 20x2 Constraint 1 (material): 20x1 + 5x2 ≤ 9500 Constraint 2 (time): 0.04x1 + 0.12x2 ≤ 40 Constraint 3 (storage): x1 + x2 ≤ 550 Positivity: x1, x2 ≥…
Sam Ang
  • 3
  • 1
0
votes
1 answer

How to evaluate the trust-constr Lagrangian?

I'm using the trust-constr algorithm from scipy.optimize.minimize with an interval constraint (lowerbound < g(x) < upperbound). I would like to plot the Lagrangian in a region around the found solution to analyze the convergence behavior. According…
0
votes
2 answers

Minimizing function in terms of integral - scipy

I want to find the parameter of a function that will result in a specific integral value in a defined interval. To make things simpler, the example below considers the function to be a straight line, and the parameter I want to find is the slope m.…
0
votes
0 answers

How to define conditional constraints in optimization utilizing Scipy minimize

I am trying to solve an optimization problem in Python environment using Scipy minimize. My problem is to apply the constraints that have if-else conditions in them. My input arguments are arrays and my objective function returns a scalar according…
0
votes
0 answers

How do I input multiple args in scipy.optimize minimize

I'm trying to solve a forces equilibrium consisting of three equations as constraints (Fx=0,Fy=0,Mx=0) and maximize the variable Vb, for which I set the objective function as -Vb. There are 4 variables that I don't know [phi, beta, gamma, delta_r]…
OIB
  • 1
0
votes
0 answers

Optimization of a class using Scipy

I wanna optimize the following class using the Scipy and got this error: RecursionError: maximum recursion depth exceeded the fact is that if I reduce wd and ws I can get the results while for higher numbers it is not possible. Indeed I need to work…
sadra
  • 21
  • 1
  • 7
0
votes
0 answers

scipy.optimize minimize function to near zero

I am performing function optimization with scipy.optimize.minimize. I want the optimization to step when the value of the function is near zero with some tolerance. If I start with a value near the actual minimum (i have computed with other solver),…
0
votes
0 answers

dimension error with scipy optimize.minimize

I want to minimise the objective function: objective_function_2() subject to the inequality constraints 69 < T(x) < 71. The objective of the optimisation is to find the set of Fourier series parameters [c0, c1, c2, wavelength] that minimises the…
kodimarka
  • 1
  • 2
0
votes
1 answer

Are Scipy Optimize Bounds inclusive?

I am trying to minimize a complex objective function that has 2 decision variables The variables have bounds as mentioned below: 0<= var1/var2 < Some_upper_bound As per my understanding of bounds variable in the optimize.minimize() function, both…
Mat
  • 41
  • 5
0
votes
0 answers

Why do Scipy functions not work properly for my problem?

I'm trying to build a model framework using python for an engineering application. The logic is as follows: Read inputs from user (Operating conditions, operating fluid) Enter guesses for fluid flow rate, pressure and two more variables…
0
votes
1 answer

Using scipy to minimize a function where the input argument is a 2D array

I have a function def f(x,a): x1, x2 = x val = np.sum(a) return val*x1**2+x2 where x are the parameters I want to optimize, and a is input data which is in the form of a 2D array. I believe fmin is the correct solver to do this. When I…