How to predict new optimum continuous values? I'm currently involved in a problem where we want to predict some values of a variable X (continuous) based on a bunch of features (like any other regression problem).
The key here is that the value of X can be optimum or not optimum, so we want our algorithm to learn to predict X in an optimum way:

For every new example of data, the result of the prediction should be a value of X as optimal as possible.

One value is optimum just if it is lower than a certain threshold (the lower the better) but fulfilling a series of restrictions about its features.
I think that one way of achieve this is filtering and keep only the examples that have an optimum X value and train our algorithm with those examples, but that would reduce the data in a considerably way, maybe disregarding possible useful information.
I would like to ask you or receive some advice about what's the correct approach for this kind of problems.
At the moment I have been thinking another way to solve this keeping all the examples: adding a new binary feature indicating if X is optimum or not, train the model with all the data and in the prediction step use the features of the example to predict but adding them a positive value as the new binary optimum feature, so the model would use all the information in which it has been trained (optimum and not optimum) to predict the example thinking that it is optimum.
This is just and idea, nothing checked or even deep thought.
What is your opinion about this? Any suggestions?
Thank you!

I wouldn't filter out the data.
Reason being is that you will make your model biased towards predicting the optimum. Look into the bias-variance trade-off. Hence, I would drop the filtering option.
Your last reasoning however seems good.
However, in the beginning, you mentioned that you are interested in predicting a continuous variable. But you are interested in predicting whether or not you have your optimum right? Which is a categorical variable.
