Help needed in some modelling issues

15 views
Skip to first unread message

Eelco

unread,
Jan 24, 2009, 8:44:37 AM1/24/09
to Xpress-MP
Hi all,

I just started in Xpress-MP and during the programming of my MIP I
came accross a few things that I cannot explain. The model runs
without any error messages, but does not produce any results. I think
this is caused by assigning (actually not assigning) initial values to
my variables.

For example, I have a binary variable Z defined over the set
FareClasses and TimeStages. This variable should have the value 1 for
the first FareClass in the first TimeStage.
Therefore, I construct the parameter Z0 with the initial requirements.

My declarations:

TimeStages = 0..T
FareClasses = 1..Q
Z0: array(FareClasses) of integer !Initial Opened
Fare Classes
Z: array(FareClasses,TimeStages) of mpvar !Opening a specific fare
class q in time stage t

Let's say Q=3, and I define the array Z0 as
Z0::[1,0,0]

I have to define that Z is binary:
forall(q in FareClasses,t in TimeStages) Z(q,t) is_binary

Furthermore, I want to assign the initial opened fare classes to my
variable:
forall(q in FareClasses) Z(q,0) = Z0(q)

When I run the model, Z(1,0) does not become equal to one, and later
on in my model the constraints where I use this variable become
pointless because it is zero.

Is this formulation correct, or do I make a mistake somewhere?

Another example,

parameters
G0 = 50 !Initial Guaranteed Capacity
end-parameters

declarations
G: array(TimeStages) of mpvar !Guaranteed Capacity
end-declarations

!Determine initial Guaranteed Capacity
G(0) = G0
!Determine Guaranteed Allocations
forall(t in 1..T) G(t) = if(t>1,G(t-1),G0) + D(t)

Does anyone have a clue?

Many thanks in advance,

Eelco

Eelco

unread,
Jan 24, 2009, 3:11:01 PM1/24/09
to Xpress-MP
Hi all,

I have another question ready for which I do not have a direct
solution. In mathematical terms what I would like to model is the
following:

B_{qt} <= Demand_{qt} + sum(v | v>q) Demand_{qt}

Where v is a subset of fareclasses, only with v>q.

When I try to do something like:

forall(q,v in FareClasses, t in TimeStages) B(q,t) <= Demand(q,t) +
sum(v|v>q) Demand(v,t)

Xpress produces the error that the index v cannot be used, because it
is already being used. Does anyone have a solution?

Many thanks!!

morgoth

unread,
Jan 30, 2009, 6:21:48 AM1/30/09
to Xpress-MP
Hi,

for your first problem:
By defining Z(q,0)=Z0(q) you do not set an initial solution, but
create a new constraint, in your case it means that Z(q,0) has to be
[1,1,0]. Literaly, it does not say "Z(1,0) equals 1", but "In a
feasible solution, Z(1,0) has to be equal to 1". Probably, your model
does not find a feasible solution and therefore the decission variable
"Z" is not assigned any value. So I would say the problem lies in your
definition of constraints.

On your second problem:
You may not use the same index in two loops. I think this is what you
would like to do:

forall(q in FareClasses, t in TimeStages) B(q,t) <= Demand(q,t) + sum
(v in FareClasses | v>q) Demand(v,t)

Greetings

David
Reply all
Reply to author
Forward
0 new messages