Questions tagged [scipy-optimize-minimize]
446 questions
0
votes
1 answer
Minimization of a function with iterative bounds in Python
I'm trying to minimize a function of N parameters (e.g. x[1],x[2],x[3]...,x[N]) where the boundaries for the minimization depend on the minimized parameters themselves. For instance, assume that all values of x could vary between 0 and 1 in such a…

Mateus Forcelini
- 121
- 8
0
votes
1 answer
why scipy.optimize.basinhopping give different results
I need to find global minimum of a complex function.
I use basinhopping from scipy.optimize. when I changed method, example method="nelder-mead" vs "L-BFGS-B" or initial guess x0, they gave me different results, especially in values of x which I…

Helena
- 1
0
votes
0 answers
optimization problem scipy.optimize.minimize
I'm having a hard time to optimize my system... I'm working on an antisolvent continuous crystallization in a tubular system and my goal is to find antisolvent flow rates at each antisolvent injection locations throughout the system length to…

Jaka Orehek
- 1
- 1
0
votes
1 answer
How to set x of a function given a target and a constraint?
I am trying to replicate somehow what excel solver would do in python.
I have a set of functions like this: P1 = f1(x), P2= f2(x), Q1= g1(x) and Q2= g2(x)
I am trying to find the value of x such as P1+P2 = some target and Q1+Q2 is minimum. can it be…

Ubaldo Gonzalez
- 31
- 1
- 5
0
votes
0 answers
Optimization with scipy
in the following code I want to optimize(maximize power output) a wind farm using scipy optimize. the variable in each iteration is c, which c=0 shows the wind turbine is off and c=1 shows, it is running. so in each iteration, I want to change C…

sadra
- 21
- 1
- 7
0
votes
1 answer
Optimization of wind farm using Penalty function in Scipy
In the following code I want to optimize a wind farm using a penalty function.
Using the first function(newsite), I have defined the wind turbines numbers and layout. Then in the next function, after importing x0(c=x0=initial guess), for each range…

sadra
- 21
- 1
- 7
0
votes
0 answers
Minimize function via scipy with the one dependent parameter
I need to optimize my function with 3 variables: r, poly, eps.
Parameter poly depends on the r parameter. r and eps are independent but have some boundaries.
How to write the constraints for the minimization function in the right way?
import numpy…

Alex97
- 73
- 2
- 9
0
votes
1 answer
Nonlinear optimization with scipy.optimize.minimize using matrices and vectors as decision variables
I have a nonlinear optimization problem which makes use of 3 decision variables, one of these variables is a single number (t), one is a vector with index i (S_i) and one is a matrix (Q_i,j) with indices i and j. I'm currently trying to use…

Bas R
- 175
- 7
0
votes
0 answers
SciPy Optimise minimise error - challenge to solve
How do I solve this error?
TypeError: NumPy boolean subtract, the `-` operator, is not supported, use the bitwise_xor, the `^` operator, or the logical_xor function instead.
I have programmed an optimizing program that must minimize the cost of a…
0
votes
1 answer
scipy.minimize with two equations returns initial values only
I would like to get an optimal solution for following equation set:
x_w * 1010 + x_m * d_m = 1017
x_w + x_m = 1
my code is as follows:
from scipy.optimize import minimize
import numpy as np
def f1(p):
x_w, x_m, d_m = p
return (x_w*1010 +…

jozi
- 15
- 1
- 6
0
votes
0 answers
Optimization and error "unsupported operand type(s) for -: 'generator' and 'generator'"
I am trying to do (from a math point of view), what is described in the following image (for presentation purpose) :
In my code , i took mock values for the experimental and initial guess vector. How could i manage to fit my b parameter , at each…

Charles
- 25
- 4
0
votes
2 answers
scipy minimize not finding solution
I'm trying to solve a set of equations using scipy.minimize, however I'm not getting satisfatory results, so maybe I'm gettting something wrong.
I want to solve the following system of equations.
12.25 * (x + y * 2.2 + z * 4.84) - 8.17437483750257 =…
user2261062
0
votes
0 answers
Using minimize function from scipy
I wrote this code where I imported data from a csv file, excluded the rows in 'area' where the value is zero. Now, I am trying to minimize the residual sum of squares error using the minimize function from scipy. From what I have seen so far is that…

qhumphrey
- 23
- 4
0
votes
1 answer
How can I get sco.minimize to give me a solution that isn't the initial guesses?
I have a piece of code that worked well when I optimized advertising budget with 2 variables (channels) but when I added aditional channels, it stopped optimizing with no error messages.
import numpy as np
import scipy.optimize as sco
# setup…

toku_mo
- 78
- 4
- 11
0
votes
1 answer
Optimization of Wind Turbine plant in Scipy
I am doing a project(using pywake library which is user-defined lib) and I have written the following code:
enter code here
import numpy as np
from py_wake.examples.data.hornsrev1 import V80
from py_wake.examples.data.hornsrev1 import…

sadra
- 5
- 4