Convex Optimization for Recuding Fractional Function

(humbang) #1

Dear all
I am a Geophysicist and I have the geophysics problem that I make it into math model using Convex Optimization. I have a fractional function f(X,n) in the form numerator and denominator ( f(X,n) = N/D) which numerator defined as:
N = 1 + (2n+1)X^2 + (n^2 + 2n)*X^4 + X^6
denominator D = 1 + (4n+3)X^2 + (n^2 + 3n)*X^4 + (n^3 + 4n)*X^6 + (n + 6)*X^8

I want to reduce f(X,n) into lower order that is new fraction function, let me define g(X,n) = P/Q, which
P = 1 + a1X + a2X^2 + a3X^3 + a4X^4
Q = 1 + b1X + b2X^2 + b3X^3 + b4X^4

The constraint, I set only n = 0.5
and 0 =< X =< 3 (interval 0.05)
abs(f(X,n) - g(X,n)) < 10e-6

I need the solution for single a1,a2,…b1,b2…b4

The MATLAB code that I make:

Tpowers=[ones(length(X),1) X X.^2 X.^3 X.^4];
u = max(f); % here f = f(X,n)
l = 0;

bisection_tol=1e-6; % bisection tolerance
while u-l>= bisection_tol
cvx_begin % solve the feasibility problem
variable A(4);
variable B(4);
subject to
if strcmp(cvx_status,‘Solved’)
a_opt = a;
b_opt = b;
objval_opt = gamma;

y_fit = Tpowers*[1;a_opt]./(Tpowers*[1;b_opt]);

The code above is well done, and now I am going to make n variable will be constraint also
where: 0 =< n=< 0.5 (interval 0.1)
and there are a looping process:

when n = 0 --> for X = 0 to 3
n = 0.1 --> for X = 0 to 3
n = 0.2 --> for X = 0 to 3

n = 0.5 --> for X = 0 to 3

Even though the n varies with fixed X = 0 to 3, I need only single a1,a2,a3,a4,b1,b2,b3, and b4
So when I obtain a1,a2,…b4 it will be valid for whole n (n = 0 to 0.5)

Could anyone help me to give this solution.

I highly appreciate your help

Thank you

(Mark L. Stone) #2

I don’t understand what you are trying to do.

Can you solve a separate problem for each value of n you w3ish to consider, then pick the best solution from these?


If these are conditional (indicator) constraints, use Big M logic, as discussed in " MIP formulations and linearizations Quick reference" by FICO


Section 9.1 of “MOSEK Modeling Cookbook”

(humbang) #3

Dear Mr. Stone

Actually, the code is adopted from Homework 6 (Prof.S. Boyd). Please see my attachment. The function in Homework 6 is slightly similar to my function above. The Homework 6 used “t” as objective function: -3 =< t =< 3, while I used single function 0 =< X =< 3 and added constant n = 0.5
Now, I am going to set “n” as a objective function also, where : 0=< n =< 0.5
So, there will be two objective functions.

If I add “n” as objective function, where the position I must add the code ?

(Mark L. Stone) #4

I still have no idea what you are trying to do. Each CVX program can have either zero objective functions or one objective function.

A single CVX program can not have tow objective functions. you can of course combine two objective functions into one, for instance with a weighted sum, any way in which you please, providing you follow CVX’s rules; but that results in a single objective function from CVX’s perspective. You can also optimize one objective function subject to a constraint on another objective function; but in that case, from CVX;'s perspective, the objective function being constrained is a constraint, not an objective function.

Providing that CVX variables are declared before they are used, and CVX expressions assigned before they are used, you can place constraints and objective function in any oderr you want between cvx_begin and cvx_end .