00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef UDINE_SOLVER_CONFIG
00022 #define UDINE_SOLVER_CONFIG
00023
00024 #include <ctime>
00025 #include <vector>
00026 #include <iostream>
00027
00028 #include <ilcplex/ilocplex.h>
00029
00030 ILOSTLBEGIN
00031
00032 namespace Udine {
00033
00034 enum SolverType {
00035 SurfaceSolver = 0,
00036 DiveSolver = 1
00037 };
00038 const int SolverTypeLen = 2;
00039
00040 enum ModelType {
00041 Monolithic = 0,
00042 Surface = 1,
00043 FixPeriod = 2,
00044 FixDay = 3
00045 };
00046 const int ModelTypeLen = 4;
00047 std::ostream & operator<< (std::ostream &out, ModelType &t);
00048
00049 enum Strategy {
00050 AnytimeAlgorithm = 0,
00051 ContractAlgorithm = 1
00052 };
00053 const int StrategyLen = 2;
00054
00055 enum FeatureUse {
00056 UseSpecialOrderedSets = 0,
00057 UseStaticCliqueCutsAtSurface = 1,
00058 UseStaticCliqueCutsInDives = 2,
00059 UseDisaggregation = 3,
00060 UseStaticImpliedBounds = 4,
00061 UseStaticPatternEnumeration = 5,
00062 UseHeuristicCompactnessAtSurface = 6,
00063 UseHeuristicCompactnessInDayDives = 7,
00064 UseNeighbourhoodLogging = 8,
00065 UseLowerBoundLogging = 9,
00066 UseSolutionLogging = 10,
00067 UseDynamicCutsAtSurface = 11,
00068 UseZeroRoomStability = 12,
00069 UsePreprocessingFriendlyFormulation = 13,
00070 UseAdditionalVariables = 14,
00071 UseLpFilesExport = 15,
00072 UseRoomSoftfixing = 16,
00073 UseMRoomAggegation = 17,
00074 UseSpreadOnlyNeighbourhoods = 18,
00075 UseObjectiveComponents = 19,
00076 };
00077 const int FeatureUseLen = 20;
00078
00079 enum FeatureUseFrequency {
00080 CutsFromPregeneratedCliques = 0,
00081 CutsFromPregeneratedPatterns = 1,
00082 CutsFromTriangles = 2,
00083 };
00084 const int FeatureUseFrequencyLen = 3;
00085
00086 enum FeatureUseCount {
00087 FixDayDiveFromSurface = 0,
00088 FixPeriodDiveFromSurface = 1,
00089 FixPeriodDiveFromFixDay = 2,
00090 };
00091 const int FeatureUseCountLen = 3;
00092
00093 struct ObjectiveWeights {
00094 float wRoomCapacity;
00095 float wMinDays;
00096 float wCompactness;
00097 float wRoomStability;
00098 ObjectiveWeights(float roomCapacity = 1, float minDays = 5, float compactness = 2, float roomStability = 1) {
00099 wRoomCapacity = roomCapacity;
00100 wMinDays = minDays;
00101 wCompactness = compactness;
00102 wRoomStability = roomStability;
00103 }
00104 };
00105
00106
00107 struct Config {
00108
00109
00110 const char *path;
00111 const char *configId;
00112 time_t globalStart;
00113
00114
00115 std::vector<IloCplex::ParameterSet> params;
00116 int upperBounds[ModelTypeLen];
00117
00118
00119 bool featureUse[FeatureUseLen];
00120 int featureUseFrequency[FeatureUseFrequencyLen];
00121 int featureUseCount[FeatureUseCountLen];
00122
00123 Strategy strategy;
00124
00125
00126 float anytimeDivingOnset[ModelTypeLen];
00127 float contractTimelimit;
00128
00129
00130 std::vector<ObjectiveWeights> weights;
00131
00132 public:
00133 Config(IloEnv &env, char *pathToInstance, const char *configIdentifier);
00134
00135
00136 time_t elapsed();
00137
00138
00139 bool getParam(FeatureUse f);
00140 int getFrequency(FeatureUseFrequency f);
00141 int getCount(FeatureUseCount c);
00142 ObjectiveWeights getWeights(ModelType s);
00143 void addSolutionCost(ModelType s, int value);
00144
00145
00146 void apply(IloCplex &cplex, ModelType instance);
00147 };
00148
00149 }
00150
00151 #endif // UDINE SOLVER CONFIG