Questions tagged [mathematical-optimization]

Questions on the optimization functions of Mathematica such as FindMinimum/FindMaximum, Minimize/Maximize, NMinimize/NMaximize, etc.

Filter by
Sorted by
Tagged with
5
votes
2answers
298 views

FindMinimum[] complains about values outside its constraints

The following optimization has a constraint that b<0, but it's failing because the integral diverges when it tries a small positive b. ...
5
votes
1answer
164 views

Question about FindMaximum

I must advise you that I am an almost total novice in mathematica.. However here is my very simple question.. I know the command FindMaximum[{f},{x}] to find the maximum point and maximum value of a ...
5
votes
1answer
223 views

What is the status of the FindMinimum method “QuadraticProgramming”?

As a method option to FindMinimum "QuadraticProgramming" is still a valid option. It has the advantage of being significantly ...
5
votes
1answer
626 views

Why does NMaximize does not follow the constraints that were given to it?

(someone may want to mark it as a duplicate, but I still have to ask! I just can't figure out why!) ...
5
votes
1answer
291 views

Solving optimal control problem when input is constrained

Given a linear time-invariant system: $$x'(t)=Ax(t)+Bu(t)$$ with initial state $x(0)=x0$ and final state $x(T)=xT$. The performance measure to be minimized is: $$∫_0^Tu(t)^2dt$$ The most important ...
5
votes
1answer
198 views

Simple maximization problem with binary variables

I tried to solve an integer-linear optimization problem but failed. I reduced the failed example to the following: ...
5
votes
1answer
278 views

maximize with assumptions on the parameters

I am trying to maximize a function of two endogenous variables (Lf and Lo), where I have two exogenous parameters (T and p), which are positive. All variables should be real. I do it as following: <...
5
votes
2answers
406 views

NMinimize Constraints on Interpolating Functions

I have the following piece of code and am trying to use NMinimize (the last line in the following chunk of code) to minimize ...
5
votes
1answer
605 views

Using ParametricNDSolve and NMinimize to find accurate interplanetary trajectory arrival periapse radius

I have an interplanetary trajectory simulation that calculates the required velocity (using a Lambert solver) and escape angle for a spacecraft to travel from Earth to Mars. This model does not use a ...
5
votes
1answer
224 views

FindMinimum's WorkingPrecision behaviour

I discovered the following behaviour when using FindMinimum for constrained optimization: ...
5
votes
1answer
152 views

Optimization over a bi-linear function

For the function $$ f(x_1,x_2;a_0,b_0)=\\\small\cases{\frac{1}{2}\left[x_1+x_2-x_1x_2+\left(\frac{-1+b_0(1-a_0)}{a_0}x_1+1\right)\left(\frac{-1+b_0(1-a_0)}{a_0}x_2+1\right)\right],\quad 0 \leq x_1\...
5
votes
1answer
155 views

NMinimize - function involves a very small number, solution is wrong

NMinimize apparently doesn't worry much about the accuracy of small numbers in the result - They don't contribute much to the overall accuracy. Example: ...
5
votes
2answers
196 views

Maximize does not return the global maximum. Why?

Bug introduced in between 10.0.1 and 10.4.1, and fixed in 11.1 I have the following code ...
5
votes
2answers
258 views

How to pass numerically evaluated constraints into nminimize?

I have a set of complicated 100 constraints which can be computed numerically for the given iterative values of the design variables. Once evaluated the lhs of the constraints are available as a ...
5
votes
1answer
214 views

Sparse Hessian for FindMinimum? Broken?

Is the sparse Hessian mechanism for FindMinimum[] (Method->"Newton") broken? Or am I simply not apprehending its proper setup? Here's what's happening. Below is for solving the example problem ...
5
votes
2answers
523 views

NMinimize in one-dimensional Interval

An Interval should be a one-dimensional region, so a region. I tried to minimize a function over an interval, e.g.: ...
5
votes
2answers
247 views

Optimization problems over the Integers

Should be an easy question. How can I define a function which gets only integers in a form that I can use to find max and min for instance? Example: Find the Max of the expression ...
5
votes
1answer
41 views

How to use StepMonitor in NMinimize when using vector variable

Bug persists through 12.0 For example, when I call this code ...
5
votes
1answer
172 views

How to use FindFit to optimize parameters of a WSM model via WSMLink for a parametric curve

I have I-V (current-voltage) data which I am trying to use to calibrate a PV solar cell model in WSM using WSMLink from mathematica. I am using the FindFit function which simulates the model with each ...
5
votes
2answers
176 views

Unexpected slowness of FindShortestTour through 9 points

This a very useful function, but it is very slow: ...
5
votes
1answer
107 views

Why is EvaluationMonitor not always run when the objective function is called?

A simple demonstration: ...
5
votes
2answers
312 views

Optimizing code containing an infinite sum

I have the following expression. It's based on the negative-log-likelihood of a Poisson-Gaussian noise model, i.e. a convolution of a Poisson & Normal distribution. The value $x_{i}$ is the ...
5
votes
1answer
171 views

Possible bug / numerical issues with HypergeometricU — any suggestions for a fast workaround?

I've encountered some problematic behaviour with HypergeometricU. I have a probability distribution on the positive integers that takes the following form after ...
5
votes
1answer
100 views

Matching spectral data to known spectral lines

Preamble: I designed some code to help me take spectral images from a spectrometer and convert pixel number into wavelength. It does reasonably well at matching a calibration spectrum of a neon lamp ...
5
votes
1answer
207 views

Numerical solution of KdV equation

I am dealing with the following Cauchy problem for the KdV equation: w'''[t] + 6 w[t] w'[t] - w'[t] = HeavisideTheta[t] w[0] = w'[0] = w''[0] = 0 My problem is ...
5
votes
1answer
2k views

How to make Maximize function successfully maximize in general?

Having looked at Maximize Documentation SO: Mathematica: Commands return no output, but itself. Bug? Problem with Maximize Why won't Mathematica Solve a set of two equations for one variable? ...
5
votes
1answer
336 views

Simple minimization not evaluating

I tried to solve a rather simple optimization problem, which Mathematica apparently cannot handle. A minimal example is the following: ...
5
votes
1answer
746 views

Slow-down encountered when using NMinimize with a compiled function

I'm minimizing a large function. Evaluating the function is very slow symbolically but using Compile I can get ~100x speed-up on this step. However, despite this, the NMinimize process is only ...
5
votes
1answer
419 views

FindMaxValue specifics

I'm using FindMaxValue to study the distribution of maxima of Abs[RiemannSiegelZ[t]] between consecutive values of ...
5
votes
0answers
124 views

What's BayesianMinimization and related functions based on?

Is it specified anywhere what the backend is for the Bayesian optimization related functionality in Mathematica v11? I'm specifically referring to the Bayesian* ...
5
votes
0answers
373 views

Amelioration of a Karush-Kuhn-Tucker nice code

In what concerns the resolution of a Karush-Kuhn-Tucker condition, this wonderful code borrowed to Parreiras (The Mathematica Journal 16 2014) which is a correction of another code by Kampas (The ...
5
votes
0answers
321 views

Softmax Regression Classification Algorithm

I'm following the Stanford Machine Learning course while simultaneously developing my Mathematica abilities. I'm having issues with my Softmax Classifier implementation (for ref, have a look at these ...
5
votes
0answers
281 views

NMinimize seems to call function with the same values multiple times

I have to minimize a function where the evaluation of one parameter set takes very long (around 5sec) and discovered alongside, that NMinimize seems to call this ...
4
votes
3answers
1k views

How to find the minimum of this constrained expression?

Let $x$, $y$, $z$ be three nonegative real numbers and $x^2 + y^2 + z^2 = 5.$ Find the minimum of the expression $$E=\dfrac{1}{2}x^2 y^2 + y^2 z^2 + z^2 x^2 + \dfrac{96}{x + y + z + 1}.$$ I tried <...
4
votes
4answers
349 views

How can I name “a[[i]]” the parts of Table “a”? Or how to make Table “a” grow inside FindMinimum?

Let's say I want to minimize a function that uses a Table named a with the Conjugate Gradient Method of ...
4
votes
2answers
440 views

How to fit a parallelogram to XY Data

I want to fit (the best/closest possible) parallelogram to a set of XY data points and obtain the co-ordinates of the vertices. The X and Y data are two independent sinusoidal type of waves, which on ...
4
votes
2answers
1k views

How to find the maximum of this function on the positive real line?

I need to maximize this function on the positive real line: $$ \frac{1}{\Gamma(x)^{14}}\cdot\frac{1}{{\frac{323.6}{14x}}^{14x}}\cdot(1.22578*10^{19})^{x-1}e^{-14x} $$ the correct answer should be ...
4
votes
1answer
263 views

NMinimize fails on Mesh?

Context I want to identify the minimum of a solution of a PDE found on a mesh. Problem I do not understand why NMinimize fails on a mesh? As a test case, ...
4
votes
2answers
306 views

Maximize simple polynomial: Wrong answer (Gives the minimum!)

I want to maximize poly under the constraints $g1,g2,g3=0$ ...
4
votes
2answers
171 views

FindMinimum with units?

Is there a way to use FindMinimum with quantities? For example: ...
4
votes
2answers
841 views

Maximization in Mathematica using matrix and vector notation

I am trying to solve a simple maximization problem in Mathematica, using matrix and vector notation. ...
4
votes
1answer
492 views

$L_\infty$ norm minimization

I write supplemental explanation to render my aim of optimization. First Consider discrete time linear system below: \begin{equation} G(z)=\frac{1-e^{-0.3T}}{z^{100}(z-e^{-0.3T})} \end{equation} ...
4
votes
1answer
1k views

How to solve a quadratic integer programming problem?

I want to solve a quadratic integer programming problem in Mathematica. My first attempt looks like this: ...
4
votes
1answer
119 views

Writing a function that finds the difference between two maxima

Suppose i have two functions: $\qquad -2x^2 +5x+3$ and $\qquad -5x^2 +2x+3$ To solve the point where the functions are at maximum i use the command NMaximize ...
4
votes
2answers
850 views

Linear Programming Using Dual Simplex method

I want to solve an optimization problem using the Dual Simplex Method. Although Mathematica gives the result directly when I use the command Minimize but I want to ...
4
votes
3answers
776 views

FindRoot constrained to maximum

I am using FindRoot to find the local maximum op some function, by examining where its derivative is zero. However, keeping the starting value the same, sometimes <...
4
votes
3answers
4k views

Determining the local extrema of discrete data [duplicate]

Possible Duplicate: Local max/min of Mathematica data sets If I have a continuous function f (for example f = Sin[x]), I ...
4
votes
3answers
304 views

Finding multiple minimum values

If I have this function (just and example) Plot3D[-Abs[Cos[ y] Sqrt[x] Sqrt[ y] Cos[ x]], {x, 0, 20}, {y, 0, 20}] I am interested in finding the locations of ...
4
votes
2answers
1k views

Finding minimal distance between two surfaces

This code will display two parametric surfaces: ...
4
votes
1answer
141 views

How can I find the greatest of this expression?

I want to find the greatest of the expression $$P=a \sqrt{12-b}+\sqrt{b\left(12+a^2\right)}+66\sqrt{a^2+b+3}-\left(a^2+b\right)^2$$ with $a >0$, $0<b\leq 12$. I tried ...