linear programming for bus tickets

giladsof

New member
Joined
Nov 22, 2016
Messages
1
Hi I work as a programmer at a bus company and I need to implement a ride initialization request. I think it might be a linear programming problem but I'm not sure and I ask for some help :)
A passenger sends my server a request to initialize a bus ride.
The request includes the different entities for the ride. For example a request might be :
Request = [2 Adults, 3 Children, 1 Dog, 2 Bikes]
My server knows what are the different tickets the passenger has. Each ticket has a cost (the price the passenger bought it with) and a list of entities it enables a ride for.
For example, a passenger might possess :
Ticket1- cost 10, enables [1 Adult, 1 Bike]
Ticket2- cost 20, enables [1 Child]
Ticket3- cost 10, enables [1 Adult, 1 Dog]

I would love some help designing an algorithm that finds the optimal collection of tickets to use for the ride (optimal being the cheapest combination), or return error if the ride isn't feasible.
I think this could be represented as a linear programming problem and then I can just use the simplex algorithm to find the optimal solution. But I'm not sure how to do it... please help me I'm not much of a math expert :/
Thank you!
 
Top