I built an AI company to save my open source project
91–100 of 112 posts
Re: I built an AI company to save my open source project
#92I have kind of an off-topic question — how did y'all get a license for using SF Pro as a Web Font on your website? Afaik Apple on licenses the SF Pro as a font to only be used on Apple devices and apps?
Re: I built an AI company to save my open source project
#93My favorite business course in undergrad was production operations management. Some time later I realized that in data engineering, critical path analysis is useful for optimizing directed acyclic graphs.
For example, it doesn't make sense to optimize the longest running task when it's not on the critical path. If you are optimizing for $, sure. But for time, there are better tasks to optimize.
Re: I built an AI company to save my open source project
#94I've looked into optaplanner/timefold but never ended up using or experimenting with it. Can anyone compare the experience to OR tools?
- In OR Tools, you need to write your constraints as mathematical equations. You can only provide your own function in a few scenarios, such as calculating the distance between two points. This allows OR Tools to eliminate symmetries and calculate gradients to improve its solution search. In Timefold, your constraints are treated like a black box, so your constraints can use any function and call any library you like (although you shouldn't do things like IO in them). However, since said constraints are a black box, Timefold is unable to eliminate symmetries or calculate gradients.
- In OR Tools, you have very little control in how it does its search. At most, you can select what algorithm/strategy it uses. In Timefold, you have a ton of control in how it does its search: from what moves its tries to adding your own custom phases. If none are configured, it will use sensible defaults. That being said, certain problems strongly benefit from custom moves.
- In OR Tools, you do not need to create custom classes; you create variables using methods on their domain model classes. In Timefold, you need to define your domain model by creating your own classes. This adds initial complexity, but it makes the code more readable: instead of your variable being an int, it is an Employee or a Visit. That being said, it can be difficult for someone to design an initial model, since it requires an understanding of the problem they are solving.
All in all, when using Timefold, you need to think in a more declarative approach (think Prolog, SQL, etc). For example, let say you have a room assignment problem where a teacher can only teach at a single room at once, and minimize room changes. In Timefold, it may look like this:
# Typically would be stored in a parameterization object, but a global var
# is used for brevity
teacher_count = 3
@planning_entity
@dataclass
class Room:
id: Annotated[int, PlanningId]
date: int
name: str
# This can also be a Teacher object, but str is used for brevity here
teacher: Annotated[str, PlanningVariable] = field(default=None)
@planning_solution
@dataclass
class Timetable:
rooms: Annotated[list[Room], PlanningEntityCollectionProperty]
teachers: Annotated[list[str], ValueRangeProvider]
score: Annotated[HardSoftScore, PlanningScore] = field(default=None)
@constraint_provider
def timetable_constraints(cf: ConstraintFactory):
return [
cf.for_each_unique_pair(Room, Joiners.equal(lambda room: room.date), Joiners.equal(lambda room: room.teacher))
.penalize(HardSoftScore.ONE_HARD)
.as_constraint('Teacher time conflict'),
cf.for_each_unique_pair(Room, Joiners.equal(lambda room: room.teacher))
.filter(lambda a, b: a.name != b.name)
.penalize(HardSoftScore.ONE_SOFT)
.as_constraint('Minimize room change')
]
solver_config = SolverConfig(
solution_class=Timetable,
entity_class_list=[Room],
score_director_factory_config=ScoreDirectorFactoryConfig(
constraint_provider_function=timetable_constraints
),
termination_config=TerminationConfig(
spent_limit=Duration(seconds=5)
)
)
solver_factory = SolverFactory.create(solver_config)
solver = solver_factory.build_solver()
problem: Timetable = build_problem()
solver.solve(problem)
Compared to OR Tools: teacher_count = 3
problem: Timetable = build_problem()
model = cp_model.CpModel()
objective = []
room_vars = [cp_model.model.new_int_var(0, teacher_count - 1, f'room_assignment_{i}' for i in range(len(problem.rooms)))]
room_vars_by_date = {date: [room_vars[i] for i in range(len(problem.rooms)) if problem.rooms[i].date == date] for date in {room.date for room in problem.rooms}}
room_vars_by_name = {name: [room_vars[i] for i in range(len(problem.rooms)) if problem.rooms[i].name == name] for name in {room.name for room in problem.rooms}}
for date, date_vars in room_vars_by_date.items():
model.AddAllDifferent(date_vars)
for name, name_vars in room_vars_by_name.items():
for assignment_1 in names_vars:
for assignment_2 in names_vars:
if assignment_1 is not assignment_2:
objective.add(assignment_1 != assignment_2)
model.minimize(sum(objective))
solver = cp_model.CpSolver()
status = solver.solve(model)Re: I built an AI company to save my open source project
#95Thank you for the hard work in this space! I think it is really important that there is a proper open source solution available. I just found OptaPlanner and subsequently TimeFold few months ago, as I was searching for a solution for my wife's veterinary clinics employee scheduling problem. The problem is not big enough for anyone to pay for the solution, but big enough to cause stress for whom ever is dealing with m…
Re: I built an AI company to save my open source project
#96Earlier quoted context omitted.
If nobody does something in a whole industry perhaps it's because it's not a differentiating factor. Do you have a link to the Swedish company? It just sounds like typical "software engineers know better" story where they go bankrupt after a few years because turns out the important bits are in other parts of the business.
Yes, this story is far too soothing to the software engineering ego to be actually true! Generally real world problems are messy, hard, and full of human problems. It's a little aggravating when 'software engineers know everything' stories like this are taken at face value and reinforce that mistaken idea.
Re: I built an AI company to save my open source project
#97Thank you for the hard work in this space! I think it is really important that there is a proper open source solution available. I just found OptaPlanner and subsequently TimeFold few months ago, as I was searching for a solution for my wife's veterinary clinics employee scheduling problem. The problem is not big enough for anyone to pay for the solution, but big enough to cause stress for whom ever is dealing with m…
Hi Tappio, read you loud and clear. We are actively looking into making it easier for all people to solve their planning problems. Our goal is to "free the world from wasteful scheduling" and we more than realize we can't do that alone. ;)
Re: I built an AI company to save my open source project
#98Geoffrey, thanks for sharing your story with us. OR sure is a weird niche. Good enough algorithms for solving these problems have existed for decades1, but we still see low adoption and your 95% estimate of the companies not optimizing their operations rings true. Similarly to you, I spent a short while trying to sell VRP optimization with an API business model, and what dawned on me was that most companies do not ha…
Thanks for sharing your story too, Yorak. Yes, having in-house expertise to integration optimization into their existing tools is hard. Especially if they use low level solver APIs (especially if it's math equations). We're working making that easier with high-level REST APIs (Timefold Field Service Routing, etc). And with education (Timefold Academy) by creating videos and articles on how to integrate real-time plan…
What you're talking about is known as a problem reduction.
Re: I built an AI company to save my open source project
#99Re: I built an AI company to save my open source project
#100Geoffrey, thanks for sharing your story with us. OR sure is a weird niche. Good enough algorithms for solving these problems have existed for decades1, but we still see low adoption and your 95% estimate of the companies not optimizing their operations rings true. Similarly to you, I spent a short while trying to sell VRP optimization with an API business model, and what dawned on me was that most companies do not ha…
If nobody does something in a whole industry perhaps it's because it's not a differentiating factor. Do you have a link to the Swedish company? It just sounds like typical "software engineers know better" story where they go bankrupt after a few years because turns out the important bits are in other parts of the business.
However I can tell you that this kind of thing really does happen. One of the injection molding conferences I attended had several presentations where companies were contemplating building more injection molding lines, but instead hired consultants (of course rolls eyes) to re-optimize their injection mold programs. After tweaking all the parameters in to speed up injection rates, it turned out the company had about 50% more capacity than they thought.
Now, I suspect this was shit management more than anything. I strongly suspect that the people on the line told their superiors that they needed to fix the programs and got ignored.
However, you couldn't sell anything to the management chain until they were staring at having to spend cash. Selling people on "saving money" is always super difficult as it requires them to change something that is nominally "working". Selling people on "not having to spend money they are staring at imminently" is always way easier. Obviously the easiest sell is "spend money to make a lot more money", but that doesn't happen all that often.