- 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
조회 수: 11 (최근 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!