Created
September 27, 2021 13:33
-
-
Save MariaLavrovskaya/14dde244b6ea1de93706732656fe72e2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
f = @(x) x.^2; %objective | |
f1 = @(x) 1-x; %inequality constraint | |
L = @(x,lambda) f(x) + lambda.*f1(x); %lagrangian | |
g = @(lambda) -1/4*lambda.^2 + lambda; %dual function | |
%% | |
[X,Lambda] = meshgrid((-1:0.01:1), (-0.5:0.01:1.5)); | |
alpha = 3; %scale x | |
beta = 4; %scale lambda |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment