Okay, so assume you have an electric propulsion (no Oberth effect) spacecraft leaving from Earth escape (for example) to Mars (for example). You want to get there much faster than a Hohmann transfer would allow, say 90 days. 1. How do you calculate delta V for the stated trip time? 2. How do you calculate thrust requirement assuming you want a constant thrust for the entire duration? 3. How do you calculate round trip duration including stay time at destination before the next return window opens? 4. Turning the problem backwards, assuming you want a round trip time to Mars of 1 year (for example), how do you determine the one way time and stay time?
The unsatisfactory answer is: numerically. You take a numeric model of the solar system, numeric, parametric model of the spacecraft, create a draft of the mission keypoints as parametric entries (departure burn time, value, insertion burn time, value, waiting for return window, departure burn from Mars, reentry prerequisites) - and then you apply an optimization algorithm and let the computer come up with answers nearest to optimal.
Analytic approach, where you calculate these values "by hand" would be far too complex to be practically usable - there are dozens of variables, some extremely non-linear equations (gravitational field of the solar system over time) and while theoretically possible, there's no mathematician on Earth who would dare to brave such a task. Instead, the answer is brute-forced through a supercomputer, calculating millions of simulations of the mission differing by parameters a little, obtaining a solution that meets the prerequisites best.
If you insist on analytic solution, you can model it using Lagrangian or Hamiltonian Mechanics, where the gravitational field of the solar system is the potential field, and each segment of flight is a separate equation of motion, with restraints of start and end speed set to be equal to these of neighboring segments. But for anything more complex than 2-body model, you'll end up with such a mess of equations nobody would dare to challenge solving them.