- 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
7 views (last 30 days)
Show older comments
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 Comments
Accepted Answer
Alan Weiss
on 20 Nov 2015
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
4 Comments
More Answers (0)
See Also
Categories
Find more on Linear Programming and Mixed-Integer Linear Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!