0
$\begingroup$

How can I create a linear equation in Gurobi (Java) from values (x-y value pairs) that also has the following properties:

$\forall x \leq 0 \Longrightarrow y = 0$

The linear line/equation should have its starting point at the x/y value, from which $y \geq 0$ and is monotonously increasing and should go maximally up to a point, at which y takes the value $\geq 1$ for the first time. All values below this point shall be $y=0$, and all values above this point shall be $y=1$.

As a small example I have attached a table: The linear equation should have its starting point at $x = 10$ and its end point at $x = 40$. For $x = 0, -10 \Longrightarrow y = 0$ and for $x = 40, 50 \Longrightarrow y=1$.

Since the values change, again and again, the whole should, of course, be generally formulated.

x y
-10 0.1
0 0.1
10 0.2
20 0.3
30 0.5
40 1.1
50 1.3
$\endgroup$
2
  • 1
    $\begingroup$ Are you trying to solve an optimization problem? It more than be an optimization problem sounds like linear regression or something like this. What is your goal? What do the decision variables mean? $\endgroup$ – A.Omidi Mar 11 at 9:37
  • $\begingroup$ The goal is to obtain a linear equation (with the mentioned constraints), which itself appears as part of my objective function in the optimization. The x and y values come from a histogram. $\endgroup$ – Handballer73 Mar 11 at 12:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.