Modeling a timeline for task allocation: Arrays? #6688
Replies: 1 comment 2 replies
-
You want arrays if you are modeling volatile storage. Array entries can be updated. The most effective way to solve your approach may be a loop outside of z3 where you create models of increased size bounds. |
Beta Was this translation helpful? Give feedback.
-
Hi all,
I am working on an algorithm that requires reasoning about a series of temporally-ordered steps for the purpose of scheduling some tasks. Currently, I have an implementation that uses a discrete number of time-stamps (Ints), and I impose ordered inequality constraints on them to specify ordering. I also have a set of tasks, which each have start and end times, and each of those values need to appear in the set of time-stamps. The times themselves are determined through the solve/optimize function. Thus, I could have a set of time-stamps of
Where the values are always increasing, but not by an equal amount each time.
However, one thing that is less than ideal about this representation is that while I am able to generate a discrete number of timestamps, this is an over-estimate, and the actual number of timestamps may vary depending on the solution found (since some tasks may start at the same time, etc). The nice capability of Z3's Array is that it supports series of arbitrary length, and you can also utilize capabilities like ForAll, which could conceptually make it cleaner when defining general rules. So, on the surface, it seems like Array might be a better option. Naïvely, this might look something like
Array("timeline",IntSort(),StateSort())
, using a custom "State" datatype. That being said, I have a couple issues/questions with how it would be implemented, and was wondering if anyone had any thoughts.Thanks for any/all feedback!
Beta Was this translation helpful? Give feedback.
All reactions