How to set boundary constraints

Hi, all!
How to set boundary constraints so that the room arrangement does not exceed the boundary?
Is there any relevant code to share?