Added solve function and used assignment model

Added comments explaining new functions