Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I'm quite new in CPLEX with C++. I'm trying to model a piecewise-linear objective function (in the LaTex notation):

F = sum_{i = 1}^{N} f_i = sum_{i = 1}^{N} K_i * (x_i - x_i^*),
K_i = K_i^1, if x_i < x_i^*; K_i^2, if x_i > x_i^*,

that is the sum of values of deviations with weight coefficients. The weight coefficients depend on the sign of the deviation and the index i.

The question is: How to define this kind of the objective function in modelling by row in terms of Ilo class or something else?

There are some examples in the internet where an objective function is represented with 2-3 variables, for example,

model.add(IloMaximize(env, x[0] + 2 * x[1] + 3 * x[2]));   

but if I have much more values? And I don't understand how to take into account the weight coefficients in such a representation.

Tnx.

question from:https://stackoverflow.com/questions/66046216/implementation-of-an-objective-with-unknown-number-of-variables

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
104 views
Welcome To Ask or Share your Answers For Others

1 Answer

Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...