You are on page 1of 19

Approximate Subdifferential of PLQ Functions in

O(log n) time

Deepak Kumar

August 3, 2016

Approximate Subdifferential of PLQ Functions in O(log n) time Deepak Kumar


Introduction

Motivation
Algorithm

Approximate Subdifferential of PLQ Functions in O(log n) time Deepak Kumar


Defination
Approximate subdifferential

Let f : Rn R {+} be a proper convex function, x dom(f ) and


 > 0. Let l(s) =  f (x) + < s, x > . Let m(s) = min{f (s), l(s)} and
X = {s  Rn : m(s) = f (s)}. Then, the approximate subdifferential of
f at x and  is the set
 f (x) = X ,
where f is the convex conjugate of f .

Approximate Subdifferential of PLQ Functions in O(log n) time Deepak Kumar


Defination
Binary Search

Binary Search is a logarithmic time search algortihm that finds the


position of a target value within sorted array by comparing the target
value to the middle element of the array; if they are unequal, the half in
which target cannot lie is eliminated and the search continues on
remaining half of array.
Procedure: Given an array A of n elements with values A0 , A1 , ...An 1
and target value T, the following algorithm uses binary search to find the
index of T in A.
Step 1: Set L to 0 and R to n-1.
L+R

Step 2: while R > L, Set m(position of middle element) to floor 2 .
Step 3: if Am < T ,set L to m+1 and go to step 2.
Step 4: if Am > T ,set R to m-1 and go to step 2.
Step 5: if Am = T , search is complete; return m.

Approximate Subdifferential of PLQ Functions in O(log n) time Deepak Kumar


Algorithm
Prerequisites

Data Structure: PLQ Matrix(CCA Toolbox Scilab)

Approximate Subdifferential of PLQ Functions in O(log n) time Deepak Kumar


Algorithm
Approximate subdifferential of a proper convex function
Input: plqf (proper convex function) with N> 0 pieces, x and 
Output: sl , su
1 binary search: find index i such that

plqf (i 1, 1) < x <= plqf (i, 1)

2 Compute plql as [+ 0 x ( f (x))]


3 binary search in left part(left index = 1 & right index = i):
1 compute Sm = 2 plqf (m, 2) plqf (m, 1) + plqf (m, 3)
2 compute FS m = Sm plqf (m, 1) f (plqf (m, 1))
3 compute Ls = Sm x + ( f (x))
4 compare FS m and Ls ; Accordingly find index(li) of PLQ function
with root(s) for plqf(li,:) & plql.
5 compute root(s); if Quadratic then two roots; compare and find if
both are feasible elseif Linear then root is at one of the end points
4 if length(roots)=2,return roots; else binary search in right
part(left index=i,right index = N)
Approximate Subdifferential of PLQ Functions in O(log n) time Deepak Kumar
Algorithm
Subroutines used and their descriptions

Functions Description
approx sub lncase(plqf,x, ) Main function calling other subroutines
plq binary search() Implementation 1 in primal & 2 in Dual domain
find solutions() Incorporates binary search jumps; returns bounds
true bound check() computes roots and checks their feasible
point lft calc() returns conjugates value at a point
roots plq plql() returns roots for quadratic and linear cases
plq ff sol() Accomodates x < plqf (1, 1);first function case
plq lf sol() Accomodates x > plqf (N 1, 1); last function c
plq extd sol() for Linear part between two Quadratic functions

Approximate Subdifferential of PLQ Functions in O(log n) time Deepak Kumar


Important Subroutines
approx sub lncase(plqf,xbar,eps)

compute plq check(plqf):if true, continue; else stop.


compute plq isConvex(plqf):if true, continue; else stop.
if plqf is bounded(semi or both sided) & x
/ dom(f ) then Error.
if N==1,
if Indicator function return sl = , su = +.
if Linear function return sl = su = plqf (1, 3){slope}.
if Quadratic function return sl = root(1), su = root(2)
if x plqf (1, :) return sl =plq ff sol(), su =plq sol right().
if x plqf (N, :) return sl =plq lf sol(), su = plq sol left().
if x plqf (i, :) such that 1 < i < N,
for left part: ssol = plq sol left(leftindex = 1, rightindex = i); if
len(ssol)==2, [sl , su ]=ssol else
sl =ssol, & for right part:
su = plq sol right(leftindex = i, rightindex = N).

Approximate Subdifferential of PLQ Functions in O(log n) time Deepak Kumar


Important Subroutines
plq binary search(plqf,ind L,ind R,implementationtype,plql,xbar,partFlag)

For finding index(i) of x: implementationtype == 1, return i.


For finding roots of plqf(i,:) & plql: implementationtype == 2,
return find solutions().

Approximate Subdifferential of PLQ Functions in O(log n) time Deepak Kumar


Important Subroutines
find solutions(plqf , indxL, indxR, plql, xbar )

[FoundPLQ,bound]=true bound check(indxL, indxR); if FoundPLQ =


False,
if indxL < 1 return true bound check(indxL + 1, indxR + 1);
if indxR > N return true bound check(indxL 1, indxR 1);
else
[FoundPLQonLeft,bound]=true bound check(indxL 1, indxR 1);
if FoundPLQonLeft=False return
true bound check(indxL + 1, indxR + 1);

Approximate Subdifferential of PLQ Functions in O(log n) time Deepak Kumar


Important Subroutines
true bound check(plqf , indxL , indxR , PLQL, xbar )

if indxL < 1, return [boundValue]=plq ff sol();


if indxR >= N, return [boundValue]=plq lf sol();
if Linear then [ ,SindxL ]=point lft calc(plqf , indxL ),
[ ,SindxR ]=point lft calc(plqf , indxR + 1, plqf (indxR , 1));
else [ ,SindxL ]=point lft calc(plqf , indxR , plqf (indxL , 1)),
[ ,SindxR ]=point lft calc(plqf , indxR );
Sroot = roots plq plql();
check (SindxL <= Sroot <= SindxR ) if true, return Sroot ;

Approximate Subdifferential of PLQ Functions in O(log n) time Deepak Kumar


Special cases
Case 1 Left Bounded & First function Linear: Conjugate is unbounded
hence two cases possible: One Solution in first function and
other in right part or Just one solution in first part:
Case 1.1 One Solution in first function and other in right part

sl = plq ff sol() & su = plq sol right()

Case 1.2 Just one solution in first part:

sl = & su = plq ff sol();

Case 2 Left Bounded & First function Quadratic: Conjugate is


bounded. Two cases possible: One Solution or Two Solutions:
Case 2.1 One Solution for Quadratic Function implies two more cases:One
Solution in first function and other in right part or Just one
solution in first part:
Case 2.1.1 One Solution in first function and other in right part Similar as
linear case
sl = plq ff sol() & su = plq sol right()

Approximate Subdifferential of PLQ Functions in O(log n) time Deepak Kumar


Special Cases
Contd....

Case 2.1.2 Just one solution in first part:


[ , sl ] = plq lft calc(plqf , 2, plqf (1, 1)) & su = plq ff sol();

Case 2.2 Two Solutions:


sl = Sroot (1), su = Sroot (2)
Case 3 Right Bounded & Last function Linear: Conjugate is unbounded
hence two cases possible: One Solution in last function and
other in left part or Just one solution in last part:
Case 3.1 One Solution in last function and other in left part

sl = plq sol left() & su = plq lf sol()

Case 3.2 Just one solution in last part:

sl = plq lf sol() & su = +;

Approximate Subdifferential of PLQ Functions in O(log n) time Deepak Kumar


Special Cases
Contd....

Case 4 Right Bounded & Last function Quadratic: Conjugate is


bounded.Hence two cases possible: One Solution or Two
Solutions:
Case 4.1 One Solution for Quadratic Function implies two more cases:One
Solution in last function and other in left part or Just one
solution in first part:
Case 4.1.1 One Solution in last function and one in left part Similar to linear
case
sl = plq sol left() & su = plq lf sol()
Case 4.1.2 Just one solution in last part: Since there is only one solution and
no solution on other part hence, upper bound should be the bounded
value in conjugate domain so
[ , sl ] = plq lf sol() & su = plq lft calc(plqf , N, plqf (N 1, 1));

Case 4.2 Two Solutions:


sl = Sroot (1), su = Sroot (2)

Approximate Subdifferential of PLQ Functions in O(log n) time Deepak Kumar


Special Cases
Contd....
Case 5 Left Unbounded & First function Linear: Conjugate is bounded
hence two cases possible: One Solution in first function and
other in right part or Just one solution in first part:
Case 5.1 One Solution in first function and other in right part
sl = plq ff sol() & su = plq sol right()
Case 5.2 Just one solution in first part:
sl = plqf (1, 3) & su = plq ff sol();
Case 6 Left Unbounded & First function Quadratic: Conjugate is
unbounded.So,two cases possible: One Solution or Two Solutions:

Case 6.1 One Solution for Quadratic Function implies two more cases:One
Solution in first function and other in right part or Just one
solution in first part:
Case 6.1.1 One Solution in first function and other in right part Similar as
linear case
sl = plq ff sol() & su = plq sol right()
Approximate Subdifferential of PLQ Functions in O(log n) time Deepak Kumar
Special Cases
Contd....

Case 6.1.2 Just one solution in first part:


[ , sl ] = & su = plq ff sol();

Case 6.2 Two Solutions:


sl = Sroot (1), su = Sroot (2)
Case 7 Right Unbounded & Last function Linear: Conjugate is bounded
hence two cases possible: One Solution in last function and
other in left part or Just one solution in last part:
Case 7.1 One Solution in last function and other in left part

sl = plq sol left() & su = plq lf sol()

Case 7.2 Just one solution in last part:

sl = plq lf sol() & su = plqf (N, 3);

Approximate Subdifferential of PLQ Functions in O(log n) time Deepak Kumar


Special Cases
Contd....

Case 8 Right Unbounded & Last function Quadratic: Conjugate is


unbounded.Hence two cases possible: One Solution or Two
Solutions:
Case 8.1 One Solution for Quadratic Function implies two more cases:One
Solution in last function and other in left part or Just one
solution in last part:
Case 8.1.1 One Solution in last function and one in left part Similar to linear
case
sl = plq sol left() & su = plq lf sol()
Case 8.1.2 Just one solution in last part: Since there is only one solution and
no solution in other part hence, upper bound should be the bounded
value in conjugate domain so
[ , sl ] = plq lf sol() & su = plq lft calc(plqf , N, plqf (N 1, 1));

Case 8.2 Two Solutions:


sl = Sroot (1), su = Sroot (2)

Approximate Subdifferential of PLQ Functions in O(log n) time Deepak Kumar


Special Cases
Contd.....

Case 9 Two adjacent Quadratic Functions When there are two adjacent
different Quadratic functions in plqf, there is discontinuity of
differential values in conjugate domain which are connected with a
linear line,so intersection(between plql & this line) could occur in
this part. Hence when this case occurs the solution is given by

lsol = plq extd sol();

Approximate Subdifferential of PLQ Functions in O(log n) time Deepak Kumar


Thank You!!!

Approximate Subdifferential of PLQ Functions in O(log n) time Deepak Kumar

You might also like