简体   繁体   English

有没有办法在 MOSEK c++ 中表示分数?

[英]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.我正在尝试通过 MOSEK c++ 实现目标 function。但是有一个问题。
When I try to make function like below, there is no dividing function in MOSEK.当我尝试像下面这样制作 function 时,MOSEK 中没有除法 function。
a is variable and b , c are parameter. a是变量, b , c是参数。

ff

I made a (numerator) and b+ac (denominator) respectivley, but I don't know how to divide them.我做a (分子)和b+ac (分母)respecivley,但我不知道如何划分它们。

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?有什么方法可以在 MOSEK 中表达派系吗?

You are using Fusion which means you have to state the problem in conic form.您正在使用 Fusion,这意味着您必须 state 圆锥形式的问题。 You can read about that in你可以在

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

But I suggest you first consider whether the function但是我建议你先考虑function是不是

a/(b+a*c) 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 plot

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

shows that the function might be nasty.显示 function 可能很讨厌。

Btw this顺便说一句

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

might be useful.可能有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM