maximizing objective function with equality and inequality constraints

Hi,
I want to estimate x_1 ,...,x_4 by maximizing
subject to and ,
which function can help me to solve this problem ,
Also, how can I convert this objective function to be convex if that is possible.
Thanks in advance

1 件のコメント

Torsten
Torsten 2023 年 1 月 20 日
編集済み: Torsten 2023 年 1 月 23 日
x1=x2=x3=0, x4=1
Should be obvious because the coefficient of x4 has the maximum value of all coefficients.
And your objective function is convex.

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

 採用された回答

Aditya
Aditya 2023 年 1 月 23 日
編集済み: Aditya 2023 年 1 月 23 日
Hi,
I understand that you want to solve this linear programming problem.
The solution for your example is trivial, as pointed out by @Torsten in comments.
In general, you can also use the linprog function to solve such problems. Here is an example to arrive at the trivial solution for your example.
Based on the documentation of linprog, I have defined the variables:
f = [4.22117991, 4.21111679, 4.22994893, 4.23060394];
Aeq = [1, 1, 1, 1];
lb = [0, 0, 0, 0];
beq = [1];
x = linprog(-f, [], [], Aeq, beq, lb, []);
You can see that the variable x is [0;0;0;1] which is the trivial solution to this problem.
The reason why I have passed negative f ( -f ) is because linprog minimizes the objective function. So, in order to maximize f, we minimize -f.

8 件のコメント

Az.Sa
Az.Sa 2023 年 1 月 31 日
Assume A_1,...,A_4 are vecotrs of 249 elements of each and my objective is to maximize :
I tried to write the code as :
clear all
data=readtable('utility.of.fitted.regressors.csv');
values=table2array(data);
A = values(:,[1]);
B= values(:,[2]);
C=values(:,[3]);
D=values(:,[4]);
f = [A , B, C , D ];
Aeq = ones(1,249);
lb = zeros(1,249);
beq = [1];
x = linprog(-f, [], [], Aeq, beq, lb, []);
I have an error Error using linprog (line 238)
The number of columns in Aeq must be the same as the number of elements of f.
length(f)= 249
Torsten
Torsten 2023 年 1 月 31 日
If A1,...,A4 are vectors , what do you try to maximize ? Vectors defined by A1x1+A2x2+A3x3+A4x4 cannot be maximized, only scalar values.
Az.Sa
Az.Sa 2023 年 2 月 2 日
編集済み: Az.Sa 2023 年 2 月 3 日
I think I missrepresent my former question: I have the following miximization objective function
where ; is a vector of 1 X p , is a matrix of p X t
The idea is to maximize the sum of the rows . That is, we sum the values evaluated at each t ( in each row) and maximize the sum over the vector of a_j. I hope this makes more sense.
Torsten
Torsten 2023 年 2 月 3 日
Yes, that makes sense.
And the solution is as simple as in the case for t=1.
Take the row with the maximum sum, say row i, and set the corresponding a(i) to 1 and all other a(j)'s to 0.
Aditya Mahamuni
Aditya Mahamuni 2023 年 6 月 23 日
In my case there are 3 variables and i have to maximise the function. all 3 variables have lower bound but one of the variable doesnt have an upper bound. what can i do in this case ?
Torsten
Torsten 2023 年 6 月 23 日
Insert "Inf" in the ub vector at the position of the variable that has no upper bound.
Aditya Mahamuni
Aditya Mahamuni 2023 年 6 月 23 日
And what can i do if i want to use the linprog function in simulink and use it at every time step ? Because when i use it, it shows me an error that "the function 'linprog' is not supported for code generation."
Torsten
Torsten 2023 年 6 月 23 日
I have no experience with this coupling, but this contribution might be helpful:

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

その他の回答 (0 件)

カテゴリ

タグ

質問済み:

2023 年 1 月 20 日

コメント済み:

2023 年 6 月 23 日

Community Treasure Hunt

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

Start Hunting!

Translated by