Skip to main content

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
96 votes
2 answers
8k views

Shaving the last 50 ms off NMinimize

The epilogue: A paper where the below answer is used was published. The answer below is cited among the references:) The background: I have to fit an objective function for ~10 000 datasets in near ...
Ajasja's user avatar
  • 13.7k
78 votes
5 answers
29k views

How to find all the local minima/maxima in a range

I want to find : all local maxima in range all local minima in range From those points I can interpolate and combine functions upper and lower boundary. What I am really interested in, is the mean ...
Margus's user avatar
  • 1,987
47 votes
2 answers
2k views

How to work with Experimental`NumericalFunction?

This question is intimately connected with previous one: "How to create internally optimized expression for computing with high WorkingPrecision?" Oleksandr R. correctly states in the comment: A ...
Alexey Popkov's user avatar
46 votes
3 answers
5k views

Identifying critical points/lines of 2/3D image/cubes

Upshot I am interested in identifying critical points of a 3D field/cubes (maxima, minima, tube-like and wall-like saddle points) and 2D field/image (maxima, minima, saddle points). I.e. the ...
chris's user avatar
  • 23.1k
42 votes
5 answers
24k views

Finding Local Minima / Maxima in Noisy Data

I'm trying to find local minima / maxima in noisy data, consisting of data values taken at certain time intervals. Ideally, the function should take a pair of lists (one containing time values and one ...
Vincent Tjeng's user avatar
36 votes
3 answers
8k views

Optimization of a portfolio of stocks

I would like to use Mathematica to perform an optimization of a portfolio composed by 10 stocks. I did the first part to compute yields and expected yields, but I don't know how to finish the ...
Mari's user avatar
  • 429
35 votes
2 answers
2k views

Convex optimization

I am playing with some Compressed Sensing (think single pixel camera) applications and would like to have a Mathematica equivalent of a Matlab package call Convex Optimization (CVX). Specifically, I ...
Patrick's user avatar
  • 359
32 votes
1 answer
728 views

FindMinimum doesn't increase step size when necessary

Behavior remains unchanged through Mathematica version 13.0.0 (Cross-posted on Wolfram Community.) I've spent much time finding a minimal example demonstrating this problem with ...
Alexey Popkov's user avatar
31 votes
2 answers
3k views

Numerical optimal control

I was hoping to tackle optimal control using Mathematica in order to learn how I can use Mathematica's built in numerical integration and optimization functions together in order to solve an optimal ...
InquisitiveInquirer's user avatar
28 votes
12 answers
8k views

how to get $n$ equidistributed points on the unit sphere

We can get $n$ equidistributed points in the unit circle using CirclePoints. But how do you get $n$ equidistributed points on the unit sphere(surface of a ball)? ...
yode's user avatar
  • 26.8k
27 votes
1 answer
824 views

Efficient multidimensional optimization while constraining some coordinates

I have a function f[x] with a high-dimensional vector input and a scalar output. I am looking to minimize this function while constraining some of the components of ...
Szabolcs's user avatar
  • 236k
26 votes
2 answers
1k views

Obtain approximate Hessian using FindMinimum

According to the documentation, when FindMinimum is told to use the method "QuasiNewton" on a unconstrained problem, it uses the ...
Ian's user avatar
  • 1,285
26 votes
2 answers
1k views

Possible bug in NMaximize function?

Bug introduced in 12.0. Fixed in 13.2 or earlier In 12.0.0 for Microsoft Windows (64-bit) (April 6, 2019) writing: ...
πρόσεχε's user avatar
26 votes
2 answers
2k views

Schedule programing problem with integer linear programming

I know how to model this question on paper, but I don't know how doing it in Mathematica. Imagine , there is a university student who want to choose courses for this semester and he got the ...
DSaad's user avatar
  • 1,173
25 votes
3 answers
1k views

Exponential fitting - isn't actually a BUG there?

There are many questions on this site about wrong exponential fitting in Mathematica but no one considers this well-known problem as a potential bug. Usually people suggest well-known workarounds ...
Alexey Popkov's user avatar
23 votes
2 answers
5k views

Differentiating functions of vectors/matrices?

I'm dealing with derivatives of scalar functions of matrices and wondering if Mathematica can help me here. The standard approach of expanding it in terms of components is cumbersome. As an ...
Yaroslav Bulatov's user avatar
21 votes
3 answers
10k views

How can I implement the method of Lagrange multipliers to find constrained extrema?

I want to form the function $h=f-\lambda_{1}g_{1}-\lambda_{2}g_{2}$ where $f$ is the function to optimize subject to the constraints $g_{1}=0$ and $g_{2}=0$ so that I can solve the first partial ...
Logan's user avatar
  • 517
21 votes
2 answers
2k views

Expressing a polynomial as a sum of squares

I encountered a degree 4 polynomial in 8 variables f(a1,a2,a3,a4,b1,b2,b3,b4) that I suspect can be written as a sum of squares. While sostools in MATLAB would find ...
pizzazz's user avatar
  • 311
21 votes
2 answers
3k views

Optimization with assumptions

I have the following problem, when I am trying to optimize function with pre-defined assumptions. I am using Mathematica 8 and I wrote the following simple code ...
Oleg's user avatar
  • 211
20 votes
4 answers
1k views

Optimization of function taking a permutation

I have a function $f$ which takes a permutation $P$ of the integers 1-100 in order to give a numerical value $f(x)$. The function is given by a black box, but is relatively "smooth", so should be ...
SPPearce's user avatar
  • 5,663
20 votes
2 answers
10k views

Find maximum value of interpolation function - obviously wrong result

Minimizing and maximizing interpolation function has already been asked and answered, see here for example. Yet, I observe a strange behaviour. Well, I can understand that the wrong guess of ...
anderstood's user avatar
  • 14.3k
20 votes
2 answers
623 views

Maximize[Cos[x - 1], x] is not evaluated

No explanation needed: Maximize[Cos[x + 1], x] Maximize[Cos[x - 1], x] producing ...
DumpsterDoofus's user avatar
19 votes
3 answers
2k views

How can I use Python's SciPy and NumPy functions in Mathematica to find the minimum of a function?

I have written my code in Mathematica, final aim of this code is to find the minimum of a function. I found that FindMinimum and ...
Gummala Navneeth's user avatar
19 votes
2 answers
1k views

Determining the default Method used in optimization and root-finding algorithms

Is it possible to extract the Method which is used in functions like NMinimize, FindRoot, <...
halirutan's user avatar
  • 113k
19 votes
1 answer
2k views

Efficiently Mowing Grass with Mathematica

Recently, I was mowing my yard and was thinking about how to use the least amount of time/fuel and how to simulate. Mowing a yard that is shaped as a convex polygon is not difficult, you can just make ...
Teg Louis's user avatar
19 votes
1 answer
3k views

Multi-objective genetic algorithm in Mathematica?

Is there any implementation of a multi-objective genetic algorithm for Mathematica?
Vahid Iraji's user avatar
18 votes
4 answers
1k views

Find the equidistance curve between two curves

I have three function $f(x)=x^x$, $g(x)=\ln(x)^{\ln(x)}$, $h(x)=\ln(x)^2$ and I want to find (numerically) $C$ the center of the circle tangent to the three curves. I think that one way is to find ...
Domenico Modica's user avatar
18 votes
1 answer
4k views

Combined numerical minimization and maximization

I want to numerically calculate the maximum of a function defined by the minimization of another function, like the following: ...
celtschk's user avatar
  • 19.2k
18 votes
1 answer
1k views

PenaltyFunction Option in NMinimize

I am curious if anybody has some experience in using the built-in Option "PenaltyFunction" in any of the numerical optimization functions like ...
Markus Roellig's user avatar
18 votes
2 answers
1k views

How can I speed up the classic GA for graph coloring?

I'm trying to compute the chromatic number of this graph (which is 28): g = Import@"http://www.info.univ-angers.fr/pub/porumbel/graphs/dsjc250.5.col"; My genetic ...
M.R.'s user avatar
  • 31.6k
17 votes
4 answers
7k views

NMinimize usage

I would like to minimize functions including the following. NMinimize[{1 - (1 - 1/n)^x - x/n, n > x, x > 1}, {n, x}] However Mathematica complains about ...
Simd's user avatar
  • 1,119
17 votes
1 answer
2k views

ParallelEvaluate for function minimization

Is there a parallelized version of a minimization routine available in Mathematica? The objective function is non-linear and the gradients have to be numerically computed. Every function evaluation ...
my account_ram's user avatar
16 votes
3 answers
8k views

Finding all maxima and minima of a function

To find all (global and local) extrema of a function in $\mathbb R^3$, I have written the following. Example function: ...
eldo's user avatar
  • 78.3k
16 votes
2 answers
559 views

Scheduling Optimization

I asked this question here 2 years ago. I didn't know this website at that time. I just realized I could ask it here. Here is the problem statement. Assume I have 20 trucks, $t_j$, $j=1...20$ and ...
OkkesDulgerci's user avatar
16 votes
1 answer
999 views

Efficiently filling area with disks located at certain points

Starting from a set of points, I want to fill an area using disks. Each disk's center should be one of the points and the disks should not overlap. I've managed to write a function that, given a list ...
einbandi's user avatar
  • 4,024
16 votes
1 answer
571 views

Bug in plotting function using FindMinimum?

Bug introduced in 10.0 and persisting through 11.0.1 or later While working on an answer to RegionPlot from NDSolve, I came across this strange behavior of ...
Michael E2's user avatar
  • 238k
15 votes
2 answers
6k views

Why can't I provide NMinimize with initial points when minimizing over two variables but not one?

Supplying initial guesses works for two parameters: ...
DJBunk's user avatar
  • 693
15 votes
1 answer
4k views

Which methods are available for NMinimize?

I can't find in the documentation the list of methods available to NMinimize[]. Is there a way to get this? The NMinimize page in Documentation Center mentions only ...
shrx's user avatar
  • 7,817
15 votes
4 answers
761 views

FindShortestTour for charity (or: How can I optimize meal delivery with FindShortestTour?)

I've been wondering about this for a while - but never got around to asking - until I saw faleichik's incredible answer to Mathematica Minecraft. I did some work at a not-for-profit a little while ...
Alexander Riccio's user avatar
15 votes
4 answers
7k views

Minimizing a function of many coordinates

I'm trying to obtain a series of points on the unit sphere with a somewhat homogeneous distribution, by minimizing a function depending on distances (I took $\exp(-d)$). My points are represented by ...
F'x's user avatar
  • 10.8k
15 votes
1 answer
8k views

Methods for NonlinearModelFit

I am using NonlinearModelFit for a thesis project. I get quite different results if I change the Method to LevenbergMarquardt or QuasiNewton or ConjugateGradient ...
Santiago's user avatar
  • 1,201
15 votes
1 answer
975 views

Minimizing with differential evolution

A differential evolution algorithm is given here. I would like to get this kind of animation. I thought I could use NMinimize, given ...
OkkesDulgerci's user avatar
15 votes
2 answers
2k views

Is it possible to use the LevenbergMarquardt algorithm for fitting a black-box residual function?

I have a black-box multiargument multiparametric function of the type SRD[dataPoint_List,params_List] which accepts experimental data along with the parameters of ...
Alexey Popkov's user avatar
15 votes
1 answer
376 views

Advanced usage of BayesianMaximization?

There’s an example in the docs for BayesianMaximization for optimizing two suboptions of a classifier with a fixed method. I would like to optimize over multiple options for Method and their various ...
user5601's user avatar
  • 3,675
14 votes
5 answers
877 views

Finding the largest disk within a convex region using Region primitives

This question asks to find the largest circle within a convex polygon, specifically this one: ...
David G. Stork's user avatar
14 votes
3 answers
2k views

Strategies to avoid LessEqual::nord in NMinimize?

When using NMinimize on functions with complex intermediate expressions (but a real end result), quite often one gets the error ...
celtschk's user avatar
  • 19.2k
14 votes
1 answer
5k views

Minimization by Nelder-Mead

Finding a global minimum for this problem (non-linear optimization by the Nelder-Mead downhill simplex method) may not be possible, but by finding local minimum, I am expecting the value of the ...
SAS's user avatar
  • 195
14 votes
1 answer
959 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 ...
sun's user avatar
  • 141
14 votes
1 answer
552 views

Packing arbitrary shapes

I'm looking for a general method of packing any set of 2D glyphs. For example, say I had 30 randomly transformed english characters: ...
M.R.'s user avatar
  • 31.6k
14 votes
1 answer
3k views

How to speed up Minimum Spanning Tree algorithm?

How to speed up MST algorithm? I work with graphs and I have adopted Prim's algorithm for my needs, from here. The graphs which I use are very dense (number of vertexes: $V=500$ and every vertex is ...
Bartek's user avatar
  • 433

1
2 3 4 5
45