-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
It should be able to have constraints on the attribute being optimized #21
Comments
Can you give an example of a problem that is not solved correctly? And what you expect the result to be? Sent from my iPhone
|
{
"name": "Computer Problem",
"optimize": "profit",
"opType": "max",
"constraints": {
"cost": {
"max": 70000
},
"size": {
"max": 1000
},
"profit": {
"max": 65000
}
},
"variables": {
"computer": {
"size": 12,
"cost": 1000,
"profit": 1000,
"computer": 1
},
"printer": {
"size": 8,
"cost": 300,
"profit": 350,
"printer": 1
}
}
} Should be 65,000; Easy solution would be to make the model go from that (above) to this (below): {
"name": "Computer Problem",
"optimize": "profit",
"opType": "max",
"constraints": {
"cost": {
"max": 70000
},
"size": {
"max": 1000
},
"random-number": {
"max": 65000
}
},
"variables": {
"computer": {
"size": 12,
"cost": 1000,
"profit": 1000,
"computer": 1,
"random-number": 1000
},
"printer": {
"size": 8,
"cost": 300,
"profit": 350,
"printer": 1,
"random-number": 350
}
}
} which yields 65,000 Its late here and I could easily be doing something wrong or overlooking something. Are you ok with this functionality? |
Ah i see, what you are trying to do is possible with the new weighting functionality on constraints. You could specify a constraint ´´´profit: { equal: 65000, weight: 1 }´´´ and remove the objective. The issue is that you might obtain a value for profit a little higher than 65,000 (if the constraint is not satisfied, you might be above as well as below the constraint). Do you have any use case for this functionality? It seems strange to limit the value of the function to optimize. Another possible way to solve it, when Quadratic Optimization is possible would be to have the following objective function: ´´´min (1000_computer + 350_printer - 65000)^2´´´. The problem with QP (quadratic programming) is that it does not seem compatible with the current json model format. |
I'm trying to think of a not-completely-contrived word problem for this and can't. I was tinkering around with the issue of solving multi-objective problems and when playing around with it, noticed that if I was minimizing an objective with a min constraint; the min constraint was ignored; which isn't what I was expecting. Out of curiosity, what's incompatible with the JSON model format? The exponents? It might be a less than ideal situation, but what if you expected a model that looked like this:
or this:
I'm not familiar with quadratic programming problems. Do you have an example a simple one? Simple like this:
|
An example of QP: min: x * x
s.t.
x >= 3; or min: x * y
s.t.
x + y >= 3; or min: (x - 5) * y
s.t.
x + y >= 3; Basically any problem where there is at least one occurence of exactly two variables being multiplied in the objective function and no occurence of more than two variables being multiplied. All the constraints should remain linear. |
what if you did something like this:
where anything in the "optimize" array (or create a new property..."quad-opt") is being multiplied. This would work on your first 2 examples. The last example, I'm not sure how to set it up; but I wouldn't know how to set it up as a linear program if the function were `x-5+y``. |
initial issue was solved with my latest commit. |
I want solver to be able to handle a use pattern like this:
Right now, if an attribute has a constraint on it and is being optimized the constraint gets ignored. An easy work-around would be something like this:
The text was updated successfully, but these errors were encountered: