- y is integer-valued
- 28*y >= n (you can represent this as a linear inequality constraint)
- The (linear) cost function includes y as one term
Ceiling function for objective function in MILP optimization
8 次查看(过去 30 天)
显示 更早的评论
Hi.
I am using intlinprog to optimise a room allocation schedule for an event. My variables are all integers.
I need to minimise the cost of running this event. Cost is incurred for multiples of 28 people in a room. For example having a room with 0-28 people costs 15$, a room with 29-56 people costs 30$.
I figured I could use the a ceiling function to round up (# of people / 28) to the closest integer, but I cont find a way to incorporate this into the objective function.
Is it possible to use ceiling, or is there a workaround?
Any ideas would be appreciated.
Thanks for reading my question. M
0 个评论
采纳的回答
Alan Weiss
2015-11-20
You can use an extra variable that keeps track of the number of segments of people/28. Here's how.
Suppose that n is the number of people (this might be a sum of some other variables in your problem). Introduce a new variable y that has the following constraints:
Then the minimum of the cost function will occur when y is minimized, meaning when it is as small as it can be but still above n/28. Then you can write your cost in terms of y.
Alan Weiss
MATLAB mathematical toolbox documentation
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Get Started with Optimization Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!