Hello,

I just started modelling with Mosel Xpress, and I'm stuck with programming one formula.

The formula avoids disjoint cycles in a Ring Star Problem, which is a Location problem in Telecommunications.

In my model, nodes *i* and *j* are in (set) *V*, with the arc {*i,j*} in (set) *E*. *z* is the variables to indicate if edge {*i,j*} is used in the cycle, where the binary variable *x_ij *indicates if node *j* is assigned to hub *i. **r* is a given root node in the graph.

The formula is

Can any one help me program the above formula?

How do I program a (virtual) subset *W *that changes when taking another node *i *?

You could use the following Mosel code to state such a constraint:

declarations

V: range ! Set of nodes

W: set of integer ! Subset of V

x,z: dynamic array(V,V) of mpvar ! Decision variables

r: integer ! Root node index

end-declarations

!... Create x and z according to network structure

sum(j,k in V | exists(z(j,k)) and (j not in W) and (k in W)) z(j,k) >= 2 * sum(i in W) x(i,i)

If you wish to modify a constraint definition later on, you need to name the constraint, eg:

Ctr:= sum(j,k in V | ...

and later edit it:

Ctr += z(i,j)

or delete it:

Ctr := 0

Note that a modification of constraint definitions requires reloading of the problem into the Optimizer, for instance in the context of iterative algorithms such as https://examples.xpress.fico.com/example.pl?id=mosel_book_6_9

If you wish to add constraints during MIP solving you need to use the cut manager functionality, see for example https://examples.xpress.fico.com/example.pl?id=mosel_solv_2_2 or https://examples.xpress.fico.com/example.pl?id=mosel_solv_21_6