Hi,

I am currently working on a proyect related to Vehicle Routing problem.

I have the following set of string:

A={"P1", "P2", "P3", "P4","P5","P6"…}

B={"K1", "K2", "K3", "K4",…}

C={"F1", "F2", "F3", "F4",…}

The sets B and C have the same size

My mpvar is X(i,j,k)

What I need is to compare the positions of this string, eg:

sum(i in A) X(i,"**F1**","**K1**")=1

sum(i in A) X(i,"**F2**","**K2**")=1

sum(i in A) X(i,"**F3**","**K3**")=1 .

.

.

.

What i first tried was

forall(j in B,k in C|j=k) sum(i in A)X(i,j,k)

It didn’t work because the elements of B will never be equal to the elements of C.

Please I do really need help with this, I am kind of new with Xpress.

Thanks

HI Julian,

Sets are not ordered collections.

To circumvent the problem you're facing, I'd recommend to define a range to serve as the index of your elements, and 2 arrays of strings:

declarations

LOCATIONS: range ! locations will be automatically populated with consecutive integers

B, C: array(LOCATIONS) of string

end-declarations

B :: ["K1", "K2", "K3", "K4",...]

C :: ["F1", "F2", "F3", "F4",…]

Regards,

Sergio