Skip to content

Commit

Permalink
remove whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
dpo committed Mar 12, 2018
1 parent f59389a commit 04eb561
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions +model/qpmodel.m
Original file line number Diff line number Diff line change
@@ -1,65 +1,65 @@
classdef qpmodel < model.nlpmodel
% nlpmodel where
% nlpmodel where
% objectif is quadratic : f(x) = c' * x + 1/2 x' * Q * x
% constraints are linear : c(x) = A * x

properties (SetAccess = private, Hidden = false)
A % Jacobian of linear constraints
c % Gradient of linear objectif
Q % Hessien (symmetric)
end

methods (Sealed = true)

function o = qpmodel(name, x0, cL, cU, bL, bU, A, c, Q)

o = [email protected](name, x0, cL, cU, bL, bU);

% Store other things.
o.A = A;
o.c = c;
o.Q = Q;

% In lpmodel, all constraints are linear
o.linear = true(o.m, 1);
end

function f = fobj_local(self, x)
f = self.c' * x + 0.5 * x' * self.Q * x;
end

function g = gobj_local(self, x)
g = self.c + self.Q * x;
end

function H = hobj_local(self, ~)
H = self.Q;
end

function c = fcon_local(self, x)
c = self.A * x;
end

function J = gcon_local(self, ~)
J = self.A;
end

function Hc = hcon_local(self, ~, ~)
Hc = sparse(self.n, self.n);
end

function H = hlag_local(self, varargin)
H = sparse(self.n, self.n);
end

function w = hlagprod_local(self, ~, ~, ~)
w = sparse(self.n, 1);
end

function w = hconprod_local(self, ~, ~, ~)
w = sparse(self.n, 1);
end

function w = ghivprod_local(self, ~, ~, ~)
w = sparse(self.n, 1);
end
Expand Down

0 comments on commit 04eb561

Please sign in to comment.