Skip to content

Commit

Permalink
Fix variable bounds for 1st week in the year (#2517)
Browse files Browse the repository at this point in the history
See function `ORTOOLS_CorrigerLesBornes`.
  • Loading branch information
flomnes authored Dec 2, 2024
1 parent 225c7a8 commit 6f017c6
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/solver/optimisation/LegacyFiller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,18 @@ void LegacyFiller::CopyMatrix(ILinearProblem& pb) const

void LegacyFiller::CreateVariable(unsigned idxVar, ILinearProblem& pb) const
{
double min_l = problemeSimplexe_->Xmin[idxVar];
double max_l = problemeSimplexe_->Xmax[idxVar];
bool isIntegerVariable = problemeSimplexe_->IntegerVariable(idxVar);
const double bMin = problemeSimplexe_->Xmin[idxVar];
const double bMax = problemeSimplexe_->Xmax[idxVar];
const int typeVar = problemeSimplexe_->TypeDeVariable[idxVar];

double min_l = (typeVar == VARIABLE_NON_BORNEE || typeVar == VARIABLE_BORNEE_SUPERIEUREMENT)
? -pb.infinity()
: bMin;
double max_l = (typeVar == VARIABLE_NON_BORNEE || typeVar == VARIABLE_BORNEE_INFERIEUREMENT)
? pb.infinity()
: bMax;
const bool isIntegerVariable = problemeSimplexe_->IntegerVariable(idxVar);

auto* var = pb.addVariable(min_l, max_l, isIntegerVariable, GetVariableName(idxVar));
pb.setObjectiveCoefficient(var, problemeSimplexe_->CoutLineaire[idxVar]);
}
Expand Down

0 comments on commit 6f017c6

Please sign in to comment.