$$Minimize~ \sum_{d \in D}{ \sum_{\rho \in P(d)}{\zeta_{\rho} z_{\rho}}}\\ \sum_{\rho \in P(d)}{\zeta_{\rho}}=1,\forall d \in D\\\tau_{s}+t_{s} \leq t_{s-1},\forall d \in D,\rho \in P(d),s \in S(\rho)- \{0 \}\\\tau_{s}+t_{s}-M_{0}+M_{0} \zeta_{\rho} \leq \zeta_{\rho} T_{d},\forall d \in D,\rho \in P(d),s \in S(\rho)-f(|S(\rho)|)\\j_{s}= \sum_{x \in X}{\alpha_{x,s} v_{x,s}},\forall d \in D,\rho \in P(d),s \in S(\rho)\\\tau_{s}= \sum_{x \in X}{\alpha_{x,s} k_{x,s}},\forall d \in D,\rho \in P(d),s \in S(\rho)\\\alpha_{x,s} \leq h_{x-1,s}+h_{x,s},\forall x \in X- \{0 \},d \in D,\rho \in P(d),s \in S(\rho)\\i_{s} \leq \sum_{y \in Y- \{|Y|-1 \}}{\kappa_{y,s} n_{y+1,s}},\forall d \in D,\rho \in P(d),s \in S(\rho)\\i_{s} \geq \sum_{y \in Y- \{|Y|-1 \}}{\kappa_{y,s} n_{y,s}},\forall d \in D,\rho \in P(d),s \in S(\rho)\\ \sum_{x \in X- \{|X|-1 \}}{h_{x,s}}=1,\forall d \in D,\rho \in P(d),s \in S(\rho)\\ \sum_{x \in X}{\alpha_{x,s}}=1,\forall d \in D,\rho \in P(d),s \in S(\rho)\\ \sum_{y \in Y- \{|Y|-1 \}}{\kappa_{y,s}}=1,\forall d \in D,\rho \in P(d),s \in S(\rho)\\e_{s,\rho,d} \leq \sum_{x \in X}{\alpha_{x,s} r_{x,y,s}}+M_{0}-M_{0} \kappa_{y,s},\forall y \in Y,d \in D,\rho \in P(d),s \in S(\rho)\\E_{s,\rho,d}=e_{s,\rho,d}+E_{s-1,\rho,d},\forall d \in D,\rho \in P(d),s \in S(\rho)- \{0 \}\\E_{s,\rho,d}=e_{s,\rho,d}+\epsilon_{0},\forall d \in D-g(|D|),\rho \in P(d),s \in S(\rho)-g(|S(\rho)|)\\E_{s,\rho,d} \leq \epsilon_{0},\forall d \in D\rho \in P(d),s \in S(\rho)\\E_{s,\rho,d} \geq \epsilon_{1},\forall d \in D\rho \in P(d),s \in S(\rho)\\E_{s,\rho,d}=e_{s,\rho,d},\forall d \in D- \{0 \},\rho \in P(d+1),s \in S(\rho)-g(|S(\rho)|)$$
            
  const vector get_constraints() {
    return this->constraints;
  }
  void add_global_index(const string & name, const int & value) {
    this->block->add_global_index(name, value);
  }
  void compile_model() {
    this->block->compile_blocks();
    for (auto b : block->get_blocks()) {
      if (b->errors_in_model()) {
        this->error = true;
        break;
      }
      for (auto s : b->get_basic_sets()) {
        this->sets[s.first] = s.second;
      }
      for (auto v : b->get_variables()) {
        this->variables[v.first] = v.second;
      }
      for (auto c : b->get_constraints()) {
        this->constraints.push_back(c);
      }
    }
    this->error |= this->block->errors_in_model();
  }

 private:
  map sets;
  map variables;
  vector constraints;
  MILPBlock *block;
  bool error;
};
            
          
elytica