File: quapro.cat

package info (click to toggle)
scilab 2.4-1
  • links: PTS
  • area: non-free
  • in suites: potato, slink
  • size: 55,196 kB
  • ctags: 38,019
  • sloc: ansic: 231,970; fortran: 148,976; tcl: 7,099; makefile: 4,585; sh: 2,978; csh: 154; cpp: 101; asm: 39; sed: 5
file content (112 lines) | stat: -rw-r--r-- 3,624 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112

quapro(1)                      Scilab Function                      quapro(1)
NAME
  quapro - linear quadratic programming solver

CALLING SEQUENCE
  [x,lagr,f]=quapro(Q,p,C,b [,x0])
  [x,lagr,f]=quapro(Q,p,C,b,ci,cs [,x0])
  [x,lagr,f]=quapro(Q,p,C,b,ci,cs,mi [,x0])
  [x,lagr,f]=quapro(Q,p,C,b,ci,cs,mi,x0 [,imp])

PARAMETERS

  Q    : real symmetric matrix (dimension n x n).

  p    : real (column) vector (dimension  n)

  C    : real matrix (dimension  (mi + md) x n) (If no constraints are given,
       you can set C = [])

  b    : RHS vector (dimension 1 x (mi + md))

  ci   : (column) vector of lower-bounds (dimension 1 x n).  If there are no
       lower bound constraints, put ci = [].  If some components of x are
       bounded from below, set the other (unconstrained) values of ci to a
       very large negative  number (e.g. ci(j) = -(% eps)^(-1).

  cs   : (column) vector of upper-bounds. (Same remarks as above).

  mi   : number of equality constraints (i.e. C(1:mi,:)*x = b(1:mi))

  x0   : either an initial guess for x
         or one of the character strings 'v' or 'g'.  If x0='v' the calcu-
       lated initial feasible point is a vertex.  If x0='g' the calculated
       initial feasible point is arbitrary.

  imp  : verbose option (optional parameter)   (Try imp=7,8,...).

  x    : optimal solution found.

  f    : optimal value of the cost function (i.e. f=p'*x).

  lagr : vector of Lagrange multipliers. If lower and upper-bounds ci,cs are
       provided, lagr has n + mi + md components and lagr(1:n) is the
       Lagrange vector associated with the bound constraints and lagr (n+1 :
       n + mi + md) is the Lagrange vector associated with the linear con-
       straints.  (If an upper-bound (resp. lower-bound) constraint i is
       active lagr(i) is > 0 (resp. <0).  If no bounds are provided, lagr has
       only mi + md components.

DESCRIPTION
  [x,lagr,f]=quapro(Q,p,C,b [,x0])

  Minimize 0.5*x'*Q*x + p'*x
  under the constraint
  C*x <= b

  [x,lagr,f]=quapro(Q,p,C,b,ci,cs [,x0])

  Minimize  0.5*x'*Q*x + p'*x

  under the constraints
  C*x <= b          ci <= x <= cs

  [x,lagr,f]=quapro(Q,p,C,b,ci,cs,mi [,x0])

  Minimize  0.5*x'*Q*x + p'*x

  under the constraints
   C(j,:) x = b(j),  j=1,...,mi
   C(j,:) x <= b(j), j=mi+1,...,mi+md
   ci <= x <= cs

  If no initial point is given the program computes a feasible initial point
  which is a vertex of the region of feasible points if x0='v'.

  If x0='g', the program computes a feasible initial point which is not
  necessarily a vertex. This mode is advisable when the quadratic form is
  positive definite and there are  few constraints in the problem or when
  there are large bounds on the variables that are just security bounds and
  very likely not active at the optimal solution.

  Note that Q is not necessarily non-negative, i.e.  Q may have negative
  eigenvalues.

EXAMPLE
  //Find x in R^6 such that:
  //C1*x = b1 (3 equality constraints i.e mi=3)
  C1= [1,-1,1,0,3,1;
      -1,0,-3,-4,5,6;
       2,5,3,0,1,0];
  b1=[1;2;3];
  //C2*x <= b2 (2 inequality constraints)
  C2=[0,1,0,1,2,-1;
      -1,0,2,1,1,0];
  b2=[-1;2.5];
  //with  x between ci and cs:
  ci=[-1000;-10000;0;-1000;-1000;-1000];cs=[10000;100;1.5;100;100;1000];
  //and minimize 0.5*x'*Q*x + p'*x with
  p=[1;2;3;4;5;6]; Q=eye(6,6);
  //No initial point is given;
  C=[C1;C2] ; //
  b=[b1;b2] ;  //
  mi=3;
  [x,lagr,f]=quapro(Q,p,C,b,ci,cs,mi)
  //Only linear constraints (1 to 4) are active (lagr(1:6)=0):
  [x,lagr,f]=quapro(Q,p,C,b,[],[],mi)   //Same result as above

SEE ALSO
  linpro
AUTHOR
  E. Casas, C. Pola Mendez