I need an advice for nonlinear optimization - nonlinear-optimization

Nowadays I am working on nonlinear mathematical model. The model is mixed integer My objective function is basically like that
Min Z= A'X+B'Y + exp(w) // A and B constants ; X and Y and w are variable
s.t.
.....
..... // the constraints linear
.....
exp(w)*C<=D // C is parameter and D is variable
How can I solve this problem ? I know it is hard to find the optimum solution but at least can you advise me some methods or solvers which solve it at least near optimum ? I tried it on LINGO but LINGO finds just local optimum . All the ideas are appreciated
Thank you so much

Related

Is there a less time-consuming way to solve a Symmetric Matrix Equation

I'm currently working on solving an equation that involves a symmetric matrix C with 4 unknown variables, and a vector A of the same dimension. The equation I'm trying to solve is:
[C]*{A}=0 (1)
where * denotes matrix multiplication and { } denotes a vector.
The dimension of the C matrix can be as large as 100x100 or more, and I'm trying to define the unknown variables in C in a way that solves equation (1). One approach I've tried is to calculate the determinant of C, |[C]|=0, and solve for the 4 different variables inside.
However, when the dimension of the matrix is large, my current method in Mathematica is not able to solve the problem. I'm wondering if anyone has any suggestions for me to solve this equation more efficiently.
I'm open to using other programming languages such as Matlab or Python as well. Any suggestions or advice would be greatly appreciated.
Thank you in advance for your help and guidance.
I have tried solving this problem with 25*25 dimension. However, this size is not enough for the percision that I want for the variables.

Matlab optimization without explicit objective function

I have a problem that I want to solve with a nonlinear optimization tool of Matlab. So far I only found methods like "fmincon". But for this, you have to have an explicit objective function.
Is there a tool, for that it's not necessary to have an explicit function?
My problem looks like this:
There is the parameter t that should be minimized.
Q, A, A*: 3x3 matrix,
t : 1x1 matrix
A = A* + Q*t
And there is a "sigma" which is calculated with A.
Sigma has to fulfill boundary conditions, e.g. sigma < 100
If someone could give me the right keywords that would be great. Thank you.

How to use Matlab's linprog or intlinprog to yield a MAXIMUM solution to optimization?

So I need to use MatLab to solve an optimization problem but this question doesn't have to be for a specific problem, this question is for optimization in general.
How do you get linprog() or intlinprog() to get the maximum solution? As far as I know, these functions only find the minimum solution to optimization problems but I need the maximum solutions.
How do I get the linear programming functions on matlab to return the maximum solution of an optimization problem?
Thanks in advance!
From documentation entries for the function linprog the function is called like that
x = linprog(f, A, b)
in order to find min f'x.
If you instead call
x = linprog(-f, A, b)
you will find max f'x
Reverse the sign of the objective function f (vector of multipliers) with a negative sign. Maximizing a function is the same as minimizing the negative of the same function.

Optimization with an inherent differential equation

I am trying to solve an optimization problem where the given objective function is to minimize
norm(R - R*)
where R is obtained by solving a boundary value problem (BVP) and `R* is a known value.
For example:
R = (p1 + p2*p3);
The BVP is given by
p1dot = p2 + p3 + x1;
p2dot = x2 + p1*p2;
p3dot = x3 + p1*p2*p3;
where x1, x2 and x3 are the optimized variables.
I am trying to solve this in MATLAB using fmincon where the BVP is solved in the objective function at every guess by the solver to estimate norm(R-R*).
EDIT 1 : I have a non linear inequality constraint which is a function of pi where i = 1,2,3. This is the reason for choosing fmincon
The issue I am facing is that during some guesses the BVP doesn't converge and the optimization stops. I guess the issue is some guess value to solve the BVP doesn't satisfy. If I give bounds to the variables then it solves the optimization problem. I am not really aware of the bounds on variables beforehand.
In order to overcome this I want to detect the guess when BVP is not solved, save them and force the optimization routine to not try values when it cannot be solved by going back to its previous guess. How do we implement this in fmincon routine?
EDIT 2 : I figured out the issue is with initial guess provided to the BVP solver. For smaller values of the optimization variables x this guess is good but when the magnitude of x increase this guess is not good enough.
Is there a way to update the solution of 'BVP' in the previous iteration as the initial guess for the next iteration in optimization. Intuitively this should fix it. Please let me know if there are some loop holes in this method.

What is the fastest method for solving exp(ax)-ax+c=0 for x in matlab

What is the least computational time consuming way to solve in Matlab the equation:
exp(ax)-ax+c=0
where a and c are constants and x is the value I'm trying to find?
Currently I am using the in built solver function, and I know the solution is single valued, but it is just taking longer than I would like.
Just wanting something to run more quickly is insufficient for that to happen.
And, sorry, but if fzero is not fast enough then you won't do much better for a general root finding tool.
If you aren't using fzero, then why not? After all, that IS the built-in solver you did not name. (BE EXPLICIT! Otherwise we must guess.) Perhaps you are using solve, from the symbolic toolbox. It will be more slow, since it is a symbolic tool.
Having said the above, I might point out that you might be able to improve by recognizing that this is really a problem with a single parameter, c. That is, transform the problem to solving
exp(y) - y + c = 0
where
y = ax
Once you know the value of y, divide by a to get x.
Of course, this way of looking at the problem makes it obvious that you have made an incorrect statement, that the solution is single valued. There are TWO solutions for any negative value of c less than -1. When c = -1, the solution is unique, and for c greater than -1, no solutions exist in real numbers. (If you allow complex results, then there will be solutions there too.)
So if you MUST solve the above problem frequently and fzero was inadequate, then I would consider a spline model, where I had precomputed solutions to the problem for a sufficient number of distinct values of c. Interpolate that spline model to get a predicted value of y for any c.
If I needed more accuracy, I might take a single Newton step from that point.
In the event that you can use the Lambert W function, then solve actually does give us a solution for the general problem. (As you see, I am just guessing what you are trying to solve this with, and what are your goals. Explicit questions help the person trying to help you.)
solve('exp(y) - y + c')
ans =
c - lambertw(0, -exp(c))
The zero first argument to lambertw yields the negative solution. In fact, we can use lambertw to give us both the positive and negative real solutions for any c no larger than -1.
X = #(c) c - lambertw([0 -1],-exp(c));
X(-1.1)
ans =
-0.48318 0.41622
X(-2)
ans =
-1.8414 1.1462
Solving your system symbolically
syms a c x;
fx0 = solve(exp(a*x)-a*x+c==0,x)
which results in
fx0 =
(c - lambertw(0, -exp(c)))/a
As #woodchips pointed out, the Lambert W function has two primary branches, W0 and W−1. The solution given is with respect to the upper (or principal) branch, denoted W0, your equation actually has an infinite number of complex solutions for Wk (the W0 and W−1 solutions are real if c is in [−∞, 0]). In Matlab, lambertw is only implemented for symbolic inputs and thus is very slow method of solving your equation if you're interested in numerical (double precision) solutions.
If you wish to solve such equations numerically in an efficient manner, you might look at Corless, et al. 1996. But, as long as your parameter c is in [−∞, 0], i.e., -exp(c) in [−1/e, 0] and you're interested in the W0 branch, you can use the Matlab code that I wrote to answer a similar question at Math.StackExchange. This code should be much much more efficient that using a naïve approach with fzero.
If your values of c are not in [−∞, 0] or you want the solution corresponding to a different branch, then your solution may be complex-valued and you won't be able to use the simple code I linked to above. In that case, you can more fully implement the function by reading the Corless, et al. 1996 paper or you can try converting the Lambert W to a Wright ω function: W0(z) = ω(log(z)), W−1(z) = ω(log(z)−2πi). In your case, using Matlab's wrightOmega, the W0 branch corresponds to:
fx0 =
(c - wrightOmega(log(-exp(c))))/a
and the W−1 branch to:
fxm1 =
(c - wrightOmega(log(-exp(c))-2*sym(pi)*1i))/a
If c is real, then the above reduces to
fx0 =
(c - wrightOmega(c+sym(pi)*1i))/a
and
fxm1 =
(c - wrightOmega(c-sym(pi)*1i))/a
Matlab's wrightOmega function is also symbolic only, but I have written a double precision implementation (based on Lawrence, et al. 2012) that you can find on my GitHub here and that is 3+ orders of magnitude faster than evaluating the function symbolically. As your problem is technically in terms of a Lambert W, it may be more efficient, and possibly more numerically accurate, to implement that more complicated function for the regime of interest (this is due to the log transformation and the extra evaluation of a complex log). But feel free to test.