Skip to content

Commit 5759f80

Browse files
authored
Editing schedulerREADME.md so equations render on GitHub
1 parent 7f38a21 commit 5759f80

File tree

1 file changed

+27
-16
lines changed

1 file changed

+27
-16
lines changed

famodel/irma/schedulerREADME.md

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,11 @@ $x = [X_{t,a} X_{t,p} X_{t,s}] $
2121

2222
## Objective Function
2323
Minimize total cost (cost is only determined by task-asset assignment):
24+
2425
$$
2526
\min \sum c_{t,a} x
2627
$$
28+
2729
The $c$ vector also contains 'cost' penalties for later start times $(X_{t,s})$ to prioritize tasks starting as early as they can (used to be Constraint 7)
2830

2931
## Constraints
@@ -33,6 +35,7 @@ When added together, these are the upperbound constraint, the lower bound constr
3335
attempts to solve the object objective function subject to:
3436

3537
subject to:
38+
3639
$$
3740
\text{1) } A_{ub} \text{ } x \text{ } \leq b_{ub} \\
3841
\text{2) } A_{eq} \text{ } x \text{ } = b_{eq} \\
@@ -42,18 +45,21 @@ $$
4245

4346
### 1. Task-Asset Validity
4447
Only valid task-asset pairs can be assigned:
48+
4549
$$
4650
X_{t,a} = 0 \quad \forall t, a \text{ where } c_{t,a} < 0 \text{ or } d_{t,a} < 0
4751
$$
4852

4953
### 3. At Least One Asset Per Task
5054
Sum of all task-asset pairs must be >= 1 for each task:
55+
5156
$$
5257
\sum_{a=0}^{A-1} X_{t,a} \geq 1 \quad \forall t
5358
$$
5459

5560
### 15. The number of task-starttime pairs must be equal to the number of tasks
5661
This ensures that each task is assigned exactly 1 start time.
62+
5763
$$
5864
\sum_{s=0}^{S-1} X_{t,s} = 1 \quad \forall t
5965
$$
@@ -69,6 +75,7 @@ When a task-asset pair is assigned, then for each start time of that task, it $(
6975

7076
### 14a. A task must occupy the same period that it starts in
7177
This ensures that the task start-time decision variable is non-zero if a task is assigned to any period.
78+
7279
$$
7380
X_{t,p}[t,s] \geq X_{t,s}[t,s] \quad \forall t
7481
$$
@@ -77,29 +84,29 @@ In every start time for each task, the corresponding period must be equal to tha
7784

7885
### 14b. A task-asset assignment must be active for the duration required by that assignment
7986

80-
14a ensures that if a task is assigned a start time, the corresponding task-period pair for the period equal to the start time is selected.
87+
14a ensured that if a task is assigned a start time, the corresponding task-period pair for the period equal to the start time is selected.
8188

8289
14b ensures that if a task is assigned a start time, the number of periods equal to the duration of the task are also turned on.
8390

84-
$ X_{t,a}[t,a] + X_{t,s}[t,s] - X_{t,p}[t,p] <= 1 \quad \forall t,a,s,p(s<s+d_{t,a})$
91+
$$
92+
X_{t,a}[t,a] + X_{t,s}[t,s] - X_{t,p}[t,p] <= 1 \quad \forall t,a,s,p(s<s+d_{t,a})
93+
$$
8594

8695
Loops through all tasks, assets, periods, and start times and assigns constraint coefficients $(A)$ to ensure the right number of periods are selected.
8796

88-
For example,
89-
90-
$ X_{t,a}[0,0] + X_{t,s}[0,0] - X_{t,p}[0,0] <= 1 $
91-
92-
ensures that $ X_{t,p}[0,0] $ is equal to 1 when the first task-asset pair is set to start in period 1, as well as the second period, given a task-asset duration of 2:
93-
94-
$ X_{t,a}[0,0] + X_{t,s}[0,0] - X_{t,p}[0,1] <= 1 $
97+
For example, $X_{t,a}[0,0] + X_{t,s}[0,0] - X_{t,p}[0,0] <= 1$
98+
ensures that $X_{t,p}[0,0]$ is equal to 1 when the first task-asset pair is set to start in period 1, as well as the second period, given a task-asset duration of 2:
99+
$X_{t,a}[0,0] + X_{t,s}[0,0] - X_{t,p}[0,1] <= 1$
95100

96101
This ensures that based on the task-asset pair selected and a given start time, the corresponding Xtp values are selected. However, this constraint represents a 'lower_bound', as these constraints don't have any control over the other Xtp values that it doesn't specify. Constraint 16 sets the 'upper bound'.
97102

98103
### 16. Each task is active for exactly its duration
99104

100105
This constraint ensures that the number of Xtp variables is EXACTLY equal to the task-asset duration, as 14b has some edge cases where some other Xtp values have the option to be turned on.
101106

102-
$ \sum_{p=0}^{P-1} X_{t,p}[t,p] = \sum_{a=0}^{A-1} X_{t,a}[t,a]d_{t,a} $
107+
$$
108+
\sum_{p=0}^{P-1} X_{t,p}[t,p] = \sum_{a=0}^{A-1} X_{t,a}[t,a]d_{t,a}
109+
$$
103110

104111
This prevents extra periods beyond the requirement from being set.
105112

@@ -126,17 +133,21 @@ This constraint is commented out and not used anymore because it created an adve
126133

127134
It was intended to ensure that a task and asset in a task-asset pair were both assigned to the same period (and updated the Xap variables accordingly)
128135

129-
$ 0 <= X_{t,p}[t,p] - X_{a,p}[a,p] + X_{t,a}[t,a] <= 1 $
136+
$$
137+
0 <= X_{t,p}[t,p] - X_{a,p}[a,p] + X_{t,a}[t,a] <= 1
138+
$$
130139

131-
However, this created a problem that when $ X_{t,a}[0,0] = 1 $, this constraint could set $ X_{t,p}[0,p] = X_{a,p}[0,p] $, but if Asset 0 was used in another task at a different time, it may not occur in that same period.
140+
However, this created a problem that when $X_{t,a}[0,0] = 1$, this constraint could set $X_{t,p}[0,p] = X_{a,p}[0,p]$, but if Asset 0 was used in another task at a different time, it may not occur in that same period.
132141

133142
Therefore, we have decided to eliminate the need for the Xap variable since they seem redundant after this investigation.
134143

135144

136145
### 4. Asset Cannot Be Assigned to Multiple Tasks in Same Period
137146
Ensures that if multiple tasks are assigned to the same asset, then only one can be active in any period p (not using any Xap variables)
138147

139-
$ \sum_{t=0}^{T-1} X_{t,p}[t,p] + \sum_{t=0}^{T-1} X_{t,a}[t,a] <= 1 + T \quad \forall a,p $
148+
$$
149+
\sum_{t=0}^{T-1} X_{t,p}[t,p] + \sum_{t=0}^{T-1} X_{t,a}[t,a] <= 1 + T \quad \forall a,p
150+
$$
140151

141152
For two tasks, the right hand side will always be 3, which ensures that if the same asset is used for multiple tasks $(X_{t,a}[0,0]=1, X_{t,a}[1,0]=1)$, then only one $X_{t,p}[t,p]$ variable is turned on.
142153

@@ -160,9 +171,9 @@ We have a set of different dependency type options:
160171
- Finish-Finish: the dependent task finishes when the prerequisite task finishes
161172
- Same-Asset: the dependent task must use the same asset as the prerequisite task
162173

163-
For all valid start times s for task t, if $ X_{t,s}[t,s]=1 $, then there is some other start time $s_d$ for task d so that $ X_{t,s}[d,s_d]=1 $ and $s_d + duration <= s$
174+
For all valid start times s for task t, if $X_{t,s}[t,s]=1$, then there is some other start time $s_d$ for task d so that $X_{t,s}[d,s_d]=1$ and $s_d + duration <= s$
164175

165-
$ X_{t,s}[t,s] <= \sum X_{t,s}[d,s_d] $ from $s$ to $sd+duration$
176+
$X_{t,s}[t,s] <= \sum X_{t,s}[d,s_d]$ from $s$ to $sd+duration$
166177

167178
---
168179

@@ -172,4 +183,4 @@ $ X_{t,s}[t,s] <= \sum X_{t,s}[d,s_d] $ from $s$ to $sd+duration$
172183

173184
- Constraints can be extended for parallel tasks, multiple assets per task, or other requirements as needed.
174185
- One of the better references to understand this approach is `Irwan et al. 2017 <http://dx.doi.org/10.1016/j.cor.2015.09.010>`_
175-
- The `scheduler.py` file also has some TODO's, which are focused on software development.
186+
- The `scheduler.py` file also has some TODO's, which are focused on software development.

0 commit comments

Comments
 (0)