I assume that the boat can only carry two persons, otherwise there is not much of a puzzle.
Martini has given the natural and obvious solution. The weakness of this solution is that in the second step, A can do nothing to prevent B from stepping ashore and ravish X.
The original version of this problem, posed by Alcuin of York (teacher of Charlemagne) more than 1200 years ago, is slightly different. There three men are travelling with their sisters, and each man desires the other girls. The question is how to cross the river without any girl being defiled. Martini's solution is not permitted, but the girls are able to row.
A mathematical method to solve problems of this kind is to look for paths in graphs. Each permissible distribution of people among the various places is a node in the graph, and two nodes are connected by an edge if it is possible to get from one node to the other with one boat trip. A solution of the problem is a path from a start node to an end node. There are simple and effective algorithms for finding paths in graphs, which makes it feasible to solve problems of this kind with hundreds of constraints.