I'm a programmer and I came a across an interesting problem. I'm sure there is a mathematical method or an algorithm to solve it, but I don't know where to start with the search nor which literature to read. If anyone can please tell me what method to use to solve this kind of problem, I would appreciate it much.

Here's a simplified example:

```
a + b + c >= 100
d + e + f >= 50
g + h >= 30
x = 1
y = 1
z = 1
5xa + 8yb + 5zc + 3xd + 2ye + 2zf + 6xg + 7yh = w.
```

I need to find the values for a, b, c, d, e, f, g and h that minimize w.

Of course, those numbers are just thought-off; the real numbers are input into my computer program by the user, and number of variables (a,b,c...) might be different for each run.

This was the simple case. In step 2, I also need to add rules like this:

```
if (8yb + 2ye + 7yh > 620) then y = 0.8 else y = 1.0
if (d > 35) then x = 0.9 else x = 1.0
etc.
```

I understand I could write a set of formulas for each rules (by replacing the value for x, y or z and adding another (in)equation), however those rules are such that they might be met, but not necessary - it is only important to minimize W, and only those rules that can "help" should be "activated". I wonder if there is some way to write "if" in mathematics?

I believe I've seen this kind of problem when I was in grad school, but that was some 10 years ago and I can't remember, so I don't even know what to look for, and I also don't know how to classify this problem. Please re-tag.