In competitive electricity markets the optimal trading problem of an electricity market agent is commonly formulated as a bi-level program, and solved as mathematical program with equilibrium constraints (MPEC). In this paper, an alternative paradigm, labeled as mathematical program with neural network constraint (MPNNC), is developed to incorporate complex market dynamics in the optimal bidding strategy. This method uses input-convex neural networks (ICNNs) to represent the mapping between the upper-level (agent) decisions and the lower-level (market) outcomes, i.e., to replace the lower-level problem by a neural network. In a comparative analysis, the optimal bidding problem of a load agent is formulated via the proposed MPNNC and via the classical bi-level programming method, and compared against each other.