Optimizing Structures with Semi-Rigid Connections Using the Principle of Virtual Work