Hello everyone,

We are currently trying to implement branch and price in Mosel and are having problems with the branch and bound part.

With the coding below the model keeps iterating, but we want it to stop when it finds an optimal and integer solution:

repeat

forall(p in column) do

writeln("z(",p,"):",getsol(z(p)))

end-do

if (getprobstat=XPRS_INF) then !solution is infeasible

writeln("infeasible problem. \n")

!break

elif (getprobstat=XPRS_OPT) then !solution is optimal

writeln ("optimal solution found")

if (getprobstat=XPRS_CB_INTSOL) then !check if solution is integer

writeln ("solution is integer")

obj:=getobjval

if (obj<UB) then !optimal solution found

UB:=obj

writeln("UB :",UB)

elif (obj>UB-1) then !violate the constraint

writeln("violated bound")

!break

end-if

else

writeln ("solution is not integer ",getobjval)

!branchingrules

forall (p in column) do

solz(p):=getsol(z(p))

if (solz(p)<>XPRS_CB_INTSOL) then !check fractional variable

solz(p):= floor(solz(p))

end-if

end-do

!addnode !add node to the pool

loadprob(MinAss)

forall (p in column) do

solz(p):=getsol(z(p))

if (solz(p)<>XPRS_CB_INTSOL) then

!branching rules

solz(p):= ceil(solz(p))

end-if

end-do

!addnode !addnode to the pool

loadprob(MinAss)

end-if

else

writeln("problem in finding solution. \n")

end-if

until (getprobstat=XPRS_OPT and get probstat=XPRS_CB_INTSOL)

Does anybody know how to make it stop and also how to call the column generation after we branch the fractional variable?

Thanks a lot in advance!

One problem in the code extract above is the use of the callback selector flag "XPRS_CB_INTSOL"

with the check of the problem status (these two are not related): you could use the routines

`function isintegral(x:mpvar):boolean`

`function isintegral(s:set of mpvar):boolean`

to check whether a variable or a set of variable have a solution value that satisfies the integrality condition.

I would also suggest that you take a look at the branch-and-price example that is provided with the Xpress distribution:

file examples/mosel/solving/GAPbp3.mos under the Xpress installation directory or in the online examples database:

FICO Xpress Examples Repository: Branch-and-Price for the Generalized Assignment Problem