Vector Optimization Problem - What should I use?

Which function should I use for the problem below?
I have a given matrix of order . I need to find the vector of order that minimizes ; subject to
1 - , where is a given vector of order
2 -
3 - , where l and u are given scalar constraints.
Thanks for any help.

12 件のコメント

Torsten
Torsten 2022 年 1 月 7 日
編集済み: Torsten 2022 年 1 月 7 日
Süleyman Polat
Süleyman Polat 2022 年 1 月 7 日
編集済み: Süleyman Polat 2022 年 1 月 7 日
@Torsten Thanks for answering. Can you look at this code?
P = [-45 -30 -30 -20 -35 -30 -40 -20 -25;
-45 -40 -25 -20 -20 -15 -15 -20 -30;
-45 -40 -30 -25 -25 -30 -30 -25 -30];
b = [-100; -100; -100];
fun = @(x) (norm(P*x));
lb = [0; 0; 0; 0; 0; 0; 0; 0; 0];
ub = [1; 1; 1; 1; 1; 1; 1; 1; 1];
intcon = 1:9;
x = ga(fun, 9, P, b, [], [], lb, ub, [], intcon);
It gives the error
"Undefined function 'ga' for input arguments of type 'function_handle'."
I'm assuming it has something to do with "fun", but I'm not very knowledgable in MATLAB.
Edit: I have MATLAB 2016b, and I have ga.m in my toolbox.
Edit 2: And this code
x = ga(@(norm(P*x)),9,P,b,[],[],lb,ub,[],intcon);
gives the error
"Unbalanced or unexpected parenthesis or bracket."
Torsten
Torsten 2022 年 1 月 7 日
編集済み: Torsten 2022 年 1 月 7 日
What is the result of using the
ver
command?
Run it from a script or in your Command Window.
If you have a license to use "ga", then look in ga.m on how to call it. Maybe it has changed since 2016.
Süleyman Polat
Süleyman Polat 2022 年 1 月 7 日
@Torsten ver command shows me my MATLAB version and such. It has Global Optimization Toolbox as well. Here's my ga.m function.
function [x,fval,exitFlag,output,population,scores] = ga(fun,nvars,Aineq,bineq,Aeq,beq,lb,ub,nonlcon,intcon,options)
Maybe the problem is nonlcon variable. I put an empty matrix there. Since I used intcon, I was supposed to put empty matrices for Aeq and beq, and I did that as well.
When I use the
which -all ga
command it shows
C:\Program Files\MATLAB\R2016b\toolbox\globaloptim\globaloptim\ga.m % Has no license available
Does that mean have a license for MATLAB, but don't have for ga.m?
Walter Roberson
Walter Roberson 2022 年 1 月 7 日
It means you do not have a license for the Global Optimization Toolbox
Matt J
Matt J 2022 年 1 月 7 日
編集済み: Matt J 2022 年 1 月 7 日
@Süleyman Polat You aren't allowed to post ga.m or other copyrighted Matlab material in the forum.
Süleyman Polat
Süleyman Polat 2022 年 1 月 7 日
@Walter Roberson Thanks, seems like it. Is there a way for me to solve this then (apart from buying the toolbox)?
Torsten
Torsten 2022 年 1 月 7 日
The "ver" command shows you the licenced toolboxes.
If the global optimization toolbox is listed, you should be able to use "ga".
The input vector to FITNESSFCN is a row vector ; so maybe you'll have to use
fun = @(x) norm(P*x.')
Süleyman Polat
Süleyman Polat 2022 年 1 月 7 日
@Torsten ver command DOES list Global Optimization Toolbox Version 3.4.1
Changing to
fun = @(x) (norm(P*x.'))
still gives the error
"Undefined function 'ga' for input arguments of type 'function_handle'.".
Walter Roberson
Walter Roberson 2022 年 1 月 7 日
ver() shows the installed toolboxes, not the licensed toolboxes.
C:\Program Files\MATLAB\R2016b\toolbox\globaloptim\globaloptim\ga.m % Has no license available
is specific: you do not have the license for the globaloptimation toolbox.
You can find various genetic algorithm implementations in the File Exchange.
Torsten
Torsten 2022 年 1 月 7 日
Thank you - good to know.
There is no command to list the licensed toolboxes ?
Walter Roberson
Walter Roberson 2022 年 1 月 7 日
temp = arrayfun(@(M){char(M.getName), license('test',char(M.getFlexName))}, com.mathworks.product.util.ProductIdentifier.values, 'UniformOutput', false);
temp = vertcat(temp{:});
licensed_products = temp([temp{:,2}]==1,1)
licensed_products = 112×1 cell array
{'5G Toolbox' } {'Aerospace Toolbox' } {'Aerospace Blockset' } {'Antenna Toolbox' } {'Audio Toolbox' } {'Powertrain Blockset' } {'AUTOSAR Blockset' } {'Bioinformatics Toolbox' } {'Communications Toolbox' } {'MATLAB Compiler' } {'MATLAB Compiler SDK' } {'Control System Toolbox' } {'Curve Fitting Toolbox' } {'Data Acquisition Toolbox' } {'Database Toolbox' } {'Datafeed Toolbox' } {'DDS Blockset' } {'Deep Learning HDL Toolbox' } {'DO Qualification Kit' } {'Automated Driving Toolbox' } {'DSP System Toolbox' } {'Embedded Coder' } {'Econometrics Toolbox' } {'HDL Verifier' } {'Spreadsheet Link' } {'Financial Toolbox' } {'Financial Instruments Toolbox' } {'Fixed-Point Designer' } {'Sensor Fusion and Tracking Toolbox'} {'Fuzzy Logic Toolbox' }

サインインしてコメントする。

回答 (0 件)

カテゴリ

製品

リリース

R2016b

タグ

質問済み:

2022 年 1 月 7 日

コメント済み:

2022 年 1 月 7 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by