MineLink
 All Data Structures Functions Variables Pages
instance.h
1 #ifndef __SCHEDULING_H__
2 #define __SCHEDULING_H__
3 
4 #include <vector>
5 #include <string>
6 #include "constraint.h"
7 #include "../../data_structures/bm/blockmodel.h"
8 #include "../../data_structures/bm/blocksel.h"
9 #include "destination.h"
10 #include "stock.h"
11 #include "list.h"
12 
13 using std::vector;
14 using std::string;
15 
16 #include <iostream>
17 
18 using namespace std;
19 namespace delphos{
23 typedef MLList<delphos::Destination> DestinationList;
24 
28 typedef MLList<delphos::Stock> StockList;
29 
30 
42 
43 private:
44 
45  vector<Constraint*> _constrs;
46  unsigned int _ctrs_size;
47  unsigned int _horizon;
48  DestinationList * _dest;
49  StockList * _stocks;
50  double * _factors;
51  BlockSelection* _bs;
52  double _discount_rate;
53 
54  typedef struct data{
55  BlockIndexType ctr;
56  BlockIndexType p;
57  char t;
58  double b;
59  }Data;
60 
61  vector<unsigned int> _ctrs_index;
62 
63  bool _is_pcpsp;
64 
65 public:
66 
67 
86  SchedulingInstance(const delphos::BlockSelection& bs,const unsigned int& horizon, const double discount_rate = 0.0, const bool& is_pcpsp=false);
87 
102  SchedulingInstance(delphos::BlockModel& bm, const unsigned int& horizon,const string& name_attr, const double discount_rate = 0.0, const bool& is_pcpsp=false);
103 
110 
123  SchedulingInstance(delphos::BlockModel& bm,const char* ml_file_name, const bool& is_pcpsp=false);
124 
143  SchedulingInstance(delphos::BlockModel& bm, const unsigned int& horizon, const double discount_rate = 0.0, const bool& is_pcpsp=false);
144 
145 
149  virtual ~SchedulingInstance();
150 
151  // static delphos::SchedulingInstance* PCPSPInstance(const char* ml_pcpsp_file_name);
152 
153 
154  #ifndef DOXYGEN
155 
160  void UnsafeAddConstraint(delphos::Constraint* ctr);
161  #endif
162 
167  void AddConstraint(delphos::Constraint* ctr);
168 
173  bool RemoveConstraint(const unsigned int& index);
174 
179  const unsigned int NumConstraints() const;
180 
184  const unsigned int GetNumConstraints() const;
185 
190  const delphos::Constraint& GetConstraint(const unsigned int& index) const;
191 
196  void AddDestination(const Destination& dest);
197 
203  void AddDestination(const string& destname, const string& destvalueattrname);
204 
209  delphos::DestinationList& Destinations();
210 
214  delphos::DestinationList& GetDestinations();
215 
216 
221  void AddStock(const Stock& stock);
222 
229  void AddStock(const string & stock_name, const string & tname, const double & tonnage);
230 
234  delphos::StockList& Stocks();
235 
239  delphos::StockList& GetStocks();
240 
244  const bool IsStock();
245 
251  void SetFixedDiscountRate(const double discount_rate);
252 
256  double GetFixedDiscountRate() const;
257 
265  void SetUpdateFactor(const unsigned int period, const double factor);
266 
270  const double GetUpdateFactor(const unsigned int period) const;
271 
276  const unsigned int Horizon() const;
277 
281  const unsigned int GetHorizon() const;
282 
286  const delphos::BlockSelection& GetBlockSelection() const;
287 
291  virtual void Report();
292 
299  delphos::SchedulingInstance* AggregateTime(const unsigned int& startperiod,const std::vector<int>& period_unit);
300 
304  bool IsPCPSP() const;
305 
306  #ifndef DOXYGEN
307 
313  void SetPCPSP(const bool& flag);
314 
315  void ConstraintToFree(const unsigned int& index);
316  #endif
317 
318 
319 };
320 
321 }
322 #endif
323 
Abstracts a set of blocks (subset of a blockmodel).
Definition: blocksel.h:33
Defines a scheduling instance to be solved.
Definition: instance.h:41
Defines a destination or process.
Definition: destination.h:21
Abstracts a container of blocks as a table with arbitrary number of attributes that can be accessed b...
Definition: blockmodel.h:62
A base class for object associated to a given block model.
Definition: blockmodel.h:1356
Defines the base class for all constraints.
Definition: constraint.h:33
Defines a pre-existing stock.
Definition: stock.h:20