Skip to content

Commit

Permalink
NL multiobj #237 #239
Browse files Browse the repository at this point in the history
Only for NL solvers with linear obj (SCIP). For proper expressions in obj, need more work in the emulator
  • Loading branch information
glebbelov committed Aug 27, 2024
1 parent 17c4522 commit 787be6c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions include/mp/flat/constr_2_expr.h
Original file line number Diff line number Diff line change
Expand Up @@ -353,11 +353,11 @@ class Constraints2Expr {
pre::AutoLinkScope<Impl> auto_link_scope{ *(Impl*)this, obj_src };
if (qobj.GetQPTerms().empty())
exprResVar = MPD( AssignResultVar2Args(
LinearFunctionalConstraint{ {lt_in_expr, 1.0} } ) );
LinearFunctionalConstraint{ {lt_in_expr, 0.0} } ) );
else // Move QP terms into the expr
exprResVar = MPD( AssignResultVar2Args(
QuadraticFunctionalConstraint
{ {{lt_in_expr, std::move(qobj.GetQPTerms())}, 1.0} } ) );
{ {{lt_in_expr, std::move(qobj.GetQPTerms())}, 0.0} } ) );
MPD( AddInitExprContext(exprResVar, // Context is compulsory
obj::MAX==qobj.obj_sense_true() // no need to propagate
? Context::CTX_POS : Context::CTX_NEG) );
Expand Down
2 changes: 1 addition & 1 deletion include/mp/flat/converter.h
Original file line number Diff line number Diff line change
Expand Up @@ -273,13 +273,13 @@ class FlatConverter :
constr_depth_ = 1; // Workaround. TODO have maps as special constraints
MP_DISPATCH( ConvertMaps() );
MP_DISPATCH( PreprocessFlatFinal() ); // final flat model prepro
MP_DISPATCH( ConsiderEmulatingMultiobj() );
if constexpr (IfAcceptingNLOutput()) {
if (IfWantNLOutput()) {
MPD( Convert2NL() );
MPD( PreprocessNLFinal() );
}
}
MP_DISPATCH( ConsiderEmulatingMultiobj() ); // After NL conversion
} catch (const ConstraintConversionFailure& cff) {
MP_RAISE(cff.message());
}
Expand Down

0 comments on commit 787be6c

Please sign in to comment.