Dealing with complex transaction costs in portfolio management