File:Opti conti constrained.svg
From Wikimedia Commons, the free media repository
Jump to navigation
Jump to search
![File:Opti conti constrained.svg](https://upload.wikimedia.org/wikipedia/commons/thumb/c/c2/Opti_conti_constrained.svg/490px-Opti_conti_constrained.svg.png?20090205222004)
Size of this PNG preview of this SVG file: 490 × 599 pixels. Other resolutions: 196 × 240 pixels | 392 × 480 pixels | 628 × 768 pixels | 837 × 1,024 pixels | 1,675 × 2,048 pixels | 512 × 626 pixels.
Original file (SVG file, nominally 512 × 626 pixels, file size: 145 KB)
File information
Structured data
Captions
Captions
Add a one-line explanation of what this file represents
Summary
[edit]DescriptionOpti conti constrained.svg |
English: Minimisation of a quadratic function under quadratic constraints
Français : Minimisation d'une fonction quadratique sous des contraintes quadratiques |
Date | |
Source | Own work |
Author | Guillaume Jacquenot |
SVG development InfoField | |
Source code InfoField | MATLAB codefunction Opti_conti_constrained
clc
h = figure;
hold on;
grid on;
box on;
axis equal;
axis([0 2.5 0 4]+0.05*[-1 1 -1 1]);
x = 4/9:0.01:2;
hp = plot(x,sqrt(18-4.5*x),...
[0.5 2],2*[0.5 2]-1,...
[0 4/9],4*[1 1],...
[0 0],[0 4],[0 0.5],[0 0]);
set(hp,'color',[0 0 0],'LineWidth',2)
[X,Y] = meshgrid(0:0.025:2.5,0:0.04:4);
Z = (X-1.5).^2+(Y-4).^2;
contour(X,Y,Z,50);
x0 = [0 0];
A = [];
b = [];
Aeq = [];
beq = [];
lb = [];
ub = [];
options = optimset('Display','iter','LargeScale','off',...
'GradObj','on',...
'Jacobian','off','Hessian','on',...
'TolX',1e-4,'TolFun',1e-4,'TolCon',1e-5,...
'MaxIter',1000,'MaxFunEvals',1e12);
[Sol_cons f_cons] = fmincon(@(x) myfun(x),x0,A,b,Aeq,beq,lb,ub,...
@(x) constraints(x),options);
[Sol_uncons f_uncons] = fminsearch(@(x)(x(1)-1.5)^2+(x(2)-4)^2,[0 0]);
plot(Sol_cons(1),Sol_cons(2),'ro')
plot(Sol_uncons(1),Sol_uncons(2),'r.')
colorbar
function [f,g,H] = myfun(x)
f = (x(1)-1.5)^2+(x(2)-4)^2; % Compute the objective function value at x
if nargout > 1 % fun called with two output arguments
g = [2*x(1)-3;2*x(2)-8]; % Gradient of the function evaluated at x
if nargout > 2
H = [2 0;0 2]; % Hessian evaluated at x
end
end
function [c,ceq] = constraints(x)
c(1,1) = 4.5*x(1)+x(2)^2-18;
A = [1 0;0 1;-1 0;0 -1;-2 1];
b = [4;4;0;0;1];
c(2:6,1) = A*x'-b;
ceq = [];
|
Minimisation
such that
Unconstrained solution:
Constrained solution:
Licensing
[edit]I, the copyright holder of this work, hereby publish it under the following licenses:
![]() |
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled GNU Free Documentation License.http://www.gnu.org/copyleft/fdl.htmlGFDLGNU Free Documentation Licensetruetrue |
![w:en:Creative Commons](https://upload.wikimedia.org/wikipedia/commons/thumb/7/79/CC_some_rights_reserved.svg/90px-CC_some_rights_reserved.svg.png)
![attribution](https://upload.wikimedia.org/wikipedia/commons/thumb/1/11/Cc-by_new_white.svg/24px-Cc-by_new_white.svg.png)
![share alike](https://upload.wikimedia.org/wikipedia/commons/thumb/d/df/Cc-sa_white.svg/24px-Cc-sa_white.svg.png)
This file is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported, 2.5 Generic, 2.0 Generic and 1.0 Generic license.
- You are free:
- to share – to copy, distribute and transmit the work
- to remix – to adapt the work
- Under the following conditions:
- attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
- share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.
You may select the license of your choice.
File history
Click on a date/time to view the file as it appeared at that time.
Date/Time | Thumbnail | Dimensions | User | Comment | |
---|---|---|---|---|---|
current | 22:20, 5 February 2009 | ![]() | 512 × 626 (145 KB) | Gjacquenot (talk | contribs) | {{Information |Description={{en|1=Minimisation of a quadratic function under quadratic constraints}} {{fr|1=Minimisation d'une fonction quadratique sous des contraintes quadratiques}} |Source=travail personnel (own work) |Author=Guillaume Jacquenot [[User |
You cannot overwrite this file.
File usage on Commons
There are no pages that use this file.