Query about simulanneal.m Function (Simulated Annealing Optimization).
古いコメントを表示
I have minimization problem which got a nonlinear objective function, a couple of equality constraints, and dozens of nonlinear constraints. There is a very simple given in MATLAB which does not contian any constraints other than objective function and starting point.
In this example inputs are only two things a function and strating points.
[x,fval,exitFlag,output] = simulannealbnd(ObjectiveFunction,x0)
Whereas I want to use following kind of function
function [x, fval, exitflag, output] = simulanneal(FUN, x0, Aineq, bineq, Aeq, beq, lb, ub, options)
which is given in the MATLAB documentations with the name of "simulanneal.m" file. Since, I want to give Aineq, bineq, lb, ub as well along with FUN and x0.
How can I implement such kind problem in MATLAB Simulated Annealig Optimization Toolbox?
Thanks
回答 (4 件)
Alan Weiss
2020 年 6 月 10 日
1 投票
Global Optimization Toolbox provides the simulannealbnd funciton, which does not provide linear constraints, though it does allow bounds.
My question would be, why do you need simulated annealing? If what you are trying to do is optimize something, then I suggest that you follow the guidance in Table for Choosing a Solver, which does not suggest using simulannealbnd.
Alan Weiss
MATLAB mathematical toolbox documentation
5 件のコメント
Muhammad Umair Javed
2020 年 6 月 12 日
Alan Weiss
2020 年 6 月 12 日
To use a general nonlinear objective function with linear constraints, the Table for Choosing a Solver I pointed you to before suggests that you use fmincon, unless the objective is nonsmooth, in which case it suggests that you use patternsearch. If, however, you also have integer constraints, then use ga or surrogateopt.
Alan Weiss
MATLAB mathematical toolbox documentation
Muhammad Umair Javed
2020 年 6 月 12 日
Alan Weiss
2020 年 6 月 12 日
surrogateopt ganed nonlinear constraint handling in R2020a. If you don't have that version, then look in your version of the documentation for an example tiitled Surrogate Optimization with Nonlinear Constraint.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation
Muhammad Umair Javed
2020 年 6 月 12 日
Muhammad Umair Javed
2020 年 6 月 23 日
2 件のコメント
Alan Weiss
2020 年 6 月 23 日
Perhaps you could try to fit your problem into the MILP framework. Your objective is linear and the constraints I see are bounds, though I do not see the code for your unitdisk constraint function. Is it possible that you could use a set of linear inequalities for the nonlinear inequality constraint, along the lines of this example? Then you could use intlinprog to solver your problem.
To answer your question though, I don't know where the 'trialData' variable might be referenced. To find out for sure, you could use the debugger.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation
Muhammad Umair Javed
2020 年 6 月 23 日
Muhammad Umair Javed
2020 年 6 月 23 日
0 投票
3 件のコメント
Alan Weiss
2020 年 6 月 23 日
I suspect that your integer variables x(9) through x(118) are binary. In that case, I believe that you can reformulate your entire problem as MILP, not nonlinear at all, and use intlinprog to solve your problem.
The objective function vector f for intlinprog is a vector of 118 zero entries, and entry 119 = 1.
That said, your current nonlinear constraint function is written incorrectly. All of the "<= 0" ASCII characters should be removed. surrogateopt will not throw an error after you remove those fallacious characters.
But I believe that you will have much better luck formulating your problem as a MILP. All of your constraints are nearly linear constraints. The only things that are nonlinear are of the form x(94)*x(117)-x(95)*x(117) or the like, where x(117) is (I strongly suspect) a binary variable, and is integer in any case. You can probably turn this into a strictly linear inequality by incorporating some extra indicator variables using a big-M formulation such as in this example.
I urge you to consider using MILP rather than a nonlinear solver to solve this nearly-linear mixed-integer problem. It requires some thought, but the solver speed will be well worthwhile.
Alan Weiss
MATLAB mathematical toolbox documentation
Muhammad Umair Javed
2020 年 6 月 25 日
tareq waheshy
2023 年 1 月 4 日
The working principle of GA is binary coding by using MATLAB code
Single variable function example
Maximize y = sqrt𝑥 subject to
Subject to 1.0 𝑥 ≤ 16.0
We know that the maximum is at y = 4.0 when x = 16
tareq waheshy
2023 年 1 月 4 日
0 投票
The working principle of GA is binary coding by using MATLAB code
Single variable function example
Maximize y = sqrt𝑥 subject to
Subject to 1.0 𝑥 ≤ 16.0
We know that the maximum is at y = 4.0 when x = 16
1 件のコメント
Steven Lord
2023 年 1 月 4 日
Since this does not appear to be an answer to the original question, but a new question, please ask it in its own thread using the Ask button at the top of this page.
カテゴリ
ヘルプ センター および File Exchange で Surrogate Optimization についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



