Conditions for mpvars in constraints, directly or indirectly

21 views
Skip to first unread message

p_sopa

unread,
Dec 9, 2008, 5:11:28 PM12/9/08
to Xpress-MP
Hello,

I have the following problem

declarations
PathCost: array(100) of real
PathLoad: array(100) of mpvar
.......
......
end-declarations

.......constraints etc.......

objective is TotalCost = sum(l in 1..100) PathCost(l) * PathLoad(l)

In reality the PathCost for each path depends on its load. The higher
the load the smaller the cost per unit load.
How can I make the PathCost change according to the PathLoad which is
an mpvar? Seems like a conversion to a non linear problem.

Changing to
TotalCost = sum(l in 1..100) (PathCost(l) / (50-PathLoad(l) ) ) *
PathLoad(l)
gives problem infeasible

Maybe
TotalCost = sum(l in 1..100) ( PathCost(l) / AdjustArray(PathLoad
(l)) ) * PathLoad(l)
I could not find a way to do it

Maybe adding some code like that
if ( PathLoad(l) >=20 ) PathCost(l) = PathCost(l)*0.2
I could not find a way to do that either

Any other way?

Thanks..

Christian Bermúdez

unread,
Dec 9, 2008, 6:24:59 PM12/9/08
to xpre...@googlegroups.com
I hope this can give you a hint to solve your problem. It´s still a non-linear problem, I think (I'm "brainstorming" :p)... I added a binary variable:
 
new declarations
x: array(100) of mpvar
 
new lines of code
forall(i in 1..100) x(i) is_binary
 
new restrictions
PathLoad(l) - x(l)  * 10000000 <= 20
"new" objective 
TotalCost = sum(l in 1..100) PathCost(l) * PathLoad(l) * (1 - x(l)) * 0.2
 
Did you check the reference problems in the Mosel documentation? Maybe they have solved that already.
 
2008/12/9 p_sopa <peter...@yahoo.com>

Christian Bermúdez

unread,
Dec 9, 2008, 6:53:01 PM12/9/08
to xpre...@googlegroups.com
Add this to my original idea and see if it works. You owe me a beer if it does:
 
new declarations
PathLoad_A: array(100) of mpvar
 
new restrictions
PathLoad_A(l) >= PathLoad(l) - (1 - x(l))  * 10000000
PathLoad_A(l) >= 0
 
"new" objective
TotalCost = sum(l in 1..100) PathCost(l) * PathLoad_A(l) * 0.2
The idea here is to add more "copy" variables to help with your cost adjustments, and sum those in the objective function. Use the original load variable for the main restrictions of your problem.
 
2008/12/9 Christian Bermúdez <as.coraz...@gmail.com>

p_sopa

unread,
Dec 10, 2008, 3:18:29 AM12/10/08
to Xpress-MP
Hi, OK I have got the beer.. So I adjust the pathload instead of the
pathcost? But how do I set X(l) the binary variable. I need to say
that for certain conditions X(l) is 1 otherwise is 0.

Peter

Calidosaúrico

unread,
Dec 29, 2008, 11:21:32 PM12/29/08
to Xpress-MP
Yes; but when you say in the model

"forall(i in 1..100) x(i) is_binary"

you are implying that (X(I) can only take values of 0 or 1). And the
conditions for the X(I) values are expressed in the "PathLoad(l)" and
"PathLoad_A(l)" restrictions. The rest is done by the optimizer.

I hope this can still help you (though I guess you have already
figured that out). Sorry for the long delay of my reply.
Reply all
Reply to author
Forward
0 new messages