Making solve() a method of Circuit class