Search code examples
c++mosek

Is there a way to express fraction in MOSEK c++?


I am trying to make objective function by MOSEK c++. But there is a problem.
When I try to make function like below, there is no dividing function in MOSEK.
a is variable and b,c are parameter.

ff

I made a (numerator) and b+ac (denominator) respectivley, but I don't know how to divide them.

So I made code like below.

Variable::t a_numerator = M->variable();
Parameter::t b_denominator_1 = M->parameter();
Parameter::t c_denominator_2 = M->parameter();
Expression::t b_add_ac = Expr::add(b_denominator_1, Expr::mul(a_numerator, c_denominator_2);

Is there any way to express faction in MOSEK?


Solution

  • You are using Fusion which means you have to state the problem in conic form. You can read about that in

    https://docs.mosek.com/modeling-cookbook/index.html

    But I suggest you first consider whether the function

    a/(b+a*c)

    is convex. (I kind of doubt that.) If it is not convex, there is no hope to express it in conic form.

    The plot

    https://www.wolframalpha.com/input?i=x%2F%281%2Bx%29

    shows that the function might be nasty.

    Btw this

    https://en.wikipedia.org/wiki/Linear-fractional_programming

    might be useful.