@@ -72,42 +72,78 @@ void TaskAddPrimalReductionCut::run()
72
72
return ;
73
73
}
74
74
75
- double relativeGap = env-> results -> getRelativeCurrentObjectiveGap () ;
75
+ double cutOffToUse ;
76
76
77
- // Different logic if gap is large
78
- if (relativeGap <= 1.0 && relativeGap > 0.1 )
77
+ if (env->settings ->getSetting <int >(" ReductionCut.Strategy" , " Dual" ) == (int )ES_ReductionCutStrategy::Fraction)
79
78
{
80
- double factor
81
- = ((double )env->solutionStatistics .numberOfPrimalReductionCutsUpdatesWithoutEffect ) / (maxIterations + 1.0 );
79
+ double relativeGap = env->results ->getRelativeCurrentObjectiveGap ();
82
80
83
- env->dualSolver ->cutOffToUse
84
- = factor * env->results ->currentDualBound + (1 - factor) * env->results ->currentPrimalBound ;
85
-
86
- if (env->reformulatedProblem ->objectiveFunction ->properties .isMinimize )
81
+ // Different logic if gap is large
82
+ if (relativeGap <= 1.0 && relativeGap > 0.1 )
87
83
{
88
- env->results ->currentDualBound = SHOT_DBL_MIN;
84
+ double factor = ((double )env->solutionStatistics .numberOfPrimalReductionCutsUpdatesWithoutEffect )
85
+ / (maxIterations + 1.0 );
86
+
87
+ cutOffToUse = factor * env->results ->currentDualBound + (1 - factor) * env->results ->currentPrimalBound ;
89
88
}
90
89
else
91
90
{
92
- env->results ->currentDualBound = SHOT_DBL_MAX;
91
+ double reductionFactor = env->settings ->getSetting <double >(" ReductionCut.ReductionFactor" , " Dual" );
92
+
93
+ if (env->reformulatedProblem ->objectiveFunction ->properties .isMinimize )
94
+ {
95
+ cutOffToUse = env->dualSolver ->cutOffToUse - reductionFactor * std::abs (env->dualSolver ->cutOffToUse );
96
+ }
97
+ else
98
+ {
99
+ cutOffToUse = env->dualSolver ->cutOffToUse + reductionFactor * std::abs (env->dualSolver ->cutOffToUse );
100
+ }
93
101
}
94
102
}
95
- else
103
+ else if (env->settings ->getSetting <int >(" ReductionCut.Strategy" , " Dual" )
104
+ == (int )ES_ReductionCutStrategy::GoldenSection)
96
105
{
97
- double reductionFactor = env-> settings -> getSetting < double >( " ReductionCut.ReductionFactor " , " Dual " ) ;
106
+ double factor = 0.618 ;
98
107
99
- if (env->reformulatedProblem ->objectiveFunction ->properties .isMinimize )
108
+ // If first cut iteration after PB update
109
+ if (env->solutionStatistics .numberOfPrimalReductionCutsUpdatesWithoutEffect == 0 )
100
110
{
101
- env->dualSolver ->cutOffToUse
102
- = env->dualSolver ->cutOffToUse - reductionFactor * std::abs (env->dualSolver ->cutOffToUse );
103
- env->results ->currentDualBound = SHOT_DBL_MIN;
111
+ if (env->reformulatedProblem ->objectiveFunction ->properties .isMinimize )
112
+ {
113
+ currentLowerBoundForReductionCut = std::max (SHOT_DBL_MIN, env->results ->globalDualBound );
114
+ }
115
+ else
116
+ {
117
+ currentLowerBoundForReductionCut = std::min (SHOT_DBL_MAX, env->results ->globalDualBound );
118
+ }
104
119
}
105
- else
120
+
121
+ cutOffToUse = (1 - factor) * currentLowerBoundForReductionCut + factor * env->results ->currentPrimalBound ;
122
+
123
+ std::cout << " Cut off diff: " << std::abs (currentLowerBoundForReductionCut - cutOffToUse) << std::endl;
124
+ if (std::abs (currentLowerBoundForReductionCut - cutOffToUse) < 1e-4 )
106
125
{
107
- env->dualSolver ->cutOffToUse
108
- = env->dualSolver ->cutOffToUse + reductionFactor * std::abs (env->dualSolver ->cutOffToUse );
109
- env->results ->currentDualBound = SHOT_DBL_MAX;
126
+ env->tasks ->setNextTask (taskIDIfFalse);
127
+ return ;
110
128
}
129
+
130
+ currentLowerBoundForReductionCut = cutOffToUse;
131
+ std::cout << " Cut off to use: " << cutOffToUse << std::endl;
132
+ std::cout << " Primal improv. after repair: "
133
+ << env->solutionStatistics .numberOfPrimalImprovementsAfterInfeasibilityRepair << std::endl;
134
+ std::cout << " Primal improv. after red. cut: "
135
+ << env->solutionStatistics .numberOfPrimalImprovementsAfterReductionCut << std::endl;
136
+ }
137
+
138
+ env->dualSolver ->cutOffToUse = cutOffToUse;
139
+
140
+ if (env->reformulatedProblem ->objectiveFunction ->properties .isMinimize )
141
+ {
142
+ env->results ->currentDualBound = SHOT_DBL_MIN;
143
+ }
144
+ else
145
+ {
146
+ env->results ->currentDualBound = SHOT_DBL_MAX;
111
147
}
112
148
113
149
std::stringstream tmpType;
0 commit comments