One of the enticing features common to most of the two-dimensional (2D) electronic systems that, in the wake of (and in parallel with) graphene, are currently at the forefront of materials science research is the ability to easily introduce a combination of planar deformations and bending in the system. Since the electronic properties are ultimately determined by the details of atomic orbital overlap, such mechanical manipulations translate into modified (or, at least, perturbed) electronic properties. Here, we present a general-purpose optimization framework for tailoring physical properties of 2D electronic systems by manipulating the state of local strain, allowing a one-step route from their design to experimental implementation. A definite example, chosen for its relevance in light of current experiments in graphene nanostructures, is the optimization of the experimental parameters that generate a prescribed spatial profile of pseudomagnetic fields (PMFs) in graphene. But the method is general enough to accommodate a multitude of possible experimental parameters and conditions whereby deformations can be imparted to the graphene lattice, and complies, by design, with grapheneʼs elastic equilibrium and elastic compatibility constraints. As a result, it efficiently answers the inverse problem of determining the optimal values of a set of external or control parameters (such as substrate topography, sample shape, load distribution, etc) that result in a graphene deformation whose associated PMF profile best matches a prescribed target. The ability to address this inverse problem in an expedited way is one key step for practical implementations of the concept of 2D systems with electronic properties strain-engineered to order. The general-purpose nature of this calculation strategy means that it can be easily applied to the optimization of other relevant physical quantities which directly depend on the local strain field, not just in graphene but in other 2D electronic membranes.