# Problem with branch and price

Question asked by s.boulaniki@student.rug.nl on Nov 21, 2014
Latest reply on Nov 25, 2014 by Susanne.Heip

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

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

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?