Question
I have a system of linear equations between ~1000 variables with ~1500 linear equations all of the form $a_0x + a_1y + a_2z ... = 0$.
I would like to change the minimum number of coefficients such that the system is solvable. Is there any known way to do this?
Motivation
I am taking all of the crafting recipes in a game and trying to work out numerical 'values' for each of the base items (the items which cannot be crafted only obtained from the environment) such that the game is consistent. IE there is no way to duplicate items by converting between them.
Each recipe is a linear equation.
I have all the recipes in the form $i_0x + i_1y + i_2z ... = o_0x + o_1y + o_2z ...$ where the $i_n$ coefficients are the amount of each item input to the recipe and the $o_n$ coefficients are the amount of each item output by the recipe.
As there are currently ways to duplicate items the system is not solvable, thus I wish to know how to make it solvable to prevent this.
PS
Any help or really just suggestions on where to look for answers would be great.
My other idea was to see if there was anything in graph theory that would help me (having each recipe as a node etc) but again I have no idea where to look.
(If it helps I have an undergraduate mathematics degree.)
~500. If you take your first thousand equations, that’ll define a unique solution for your thousand variables assuming there isn’t already a linear dependence in your equations. If there is some dependencies, add more equations. If your coefficients are random reals, this is unlikely (probability 0). If they’re nice numbers (like integers), you might get some overlap so you’ll need to throw some more equations in there which would reduce the amount you need to adjust. Then you can adjust one coefficient of a nonzero variable in each of the remaining around 500 equations to get them to work.
The simplest approach would be to add some money. Assign an approximate cost to each item (I.e. add up all the stats/rarities of your item or something - doesn’t have to be exact), and then charge the monetary difference of the input items and output items to the player whenever they convert. You can even make it so each transactions costs a bit on top of that to prevent needless cycles and reduce the incentives of players to excessively trade. This is equivalent to just adjusting the coefficient of a single variable for all your equations.
If you don’t want explicit coinage in the crafting process, you just need to make sure your inputs are always more valuable than your outputs according to any pricing system. I.e. assign prices either as above or randomly and then increase the material cost for any transaction whose outputs are too valuable.