Quintiq file version 2.0
|
#parent: #root
|
Method CompleteForCampaignSequencingSimple (
|
SelectorMeta selectormeta,
|
RunContextMeta rcm,
|
RunContextForCapacityPlanning runcontext
|
)
|
{
|
TextBody:
|
[*
|
// this method is added for efficiency of the meta optimizer. We want to limit the duplicate calls to add operations, unitperiods, unit and trip. So we do this all the way at the end
|
// based on period tasks and product in trips added
|
|
sequencecampaigns := runcontext.UseCampaignSequenceOptimizer() and runcontext.UseCampaign();
|
if ( sequencecampaigns )
|
{
|
mp := runcontext.FirstPeriod_MP().MacroPlan();
|
traverse( mp, Optimization.OptCampaignCampaignType, ctype )
|
{
|
ctype.IsActive( false );
|
}
|
unitswithperiodsinscope := construct( Units );
|
anchorsforupstream := construct( ProductInStockingPointInPeriodPlanningLeafs );
|
traverse( this.GetUnitInOptimizerRun(), Elements, unit, unit.HasCampaignType() )
|
{
|
traverse( unit, UnitPeriod, up, up.IsPlanning() and not up.IsPeriodFrozen() and not up.Period_MP().IsHistorical() )
|
{
|
unitswithperiodsinscope.Add( unit );
|
this.Add( up );
|
|
traverse( up, PeriodTaskOperation, pto, PeriodTaskOperation::GetIsValidPeriodTask( pto.Operation(), pto.UnitPeriod().Period_MP() ) )
|
{
|
this.Add( pto );
|
this.Add( pto.Operation() );
|
traverse( pto, DependentDemand.ProductInStockingPointInPeriodPlanningLeaf, pispip )
|
{
|
this.Add( pispip );
|
anchorsforupstream.Add( pispip );
|
this.Add( pispip.StockingPointInPeriod() );
|
this.Add( pispip.Period_MP() );
|
}
|
traverse( pto, NewSupply.ProductInStockingPointInPeriodPlanningLeaf, pispip )
|
{
|
this.Add( pispip );
|
this.Add( pispip.StockingPointInPeriod() );
|
this.Add( pispip.Period_MP() );
|
}
|
} // end traverse period task
|
} // end traverse unit period
|
} // end traverse unit with campaign type
|
|
selectormeta.PISPGapFill( this, runcontext );
|
|
unitswithperiodsinscope := unitswithperiodsinscope.Unique();
|
unitswithperiodsinscope := selectsortedset( unitswithperiodsinscope, Elements, unit, true, Real::Random() );
|
maxnrcampaigntypesinscope := rcm.OptionMaxNrCampaignTypeActivePerUnit() ;
|
|
traverse( unitswithperiodsinscope, Elements, unit )
|
{
|
optcampaigntypes := selectsortedset( unit, CampaignType_MP.OptCampaignCampaignType, ctype, true, Real::Random() );
|
activenrofcampaignsforunit := Number::Random(0, maxnrcampaigntypesinscope );
|
optcampaigntypes := optcampaigntypes.SelectFirst( activenrofcampaignsforunit );
|
debuginfo( 'unit:', unit.Name(), 'active nr of campaigns = ', optcampaigntypes.Size() );
|
traverse( optcampaigntypes, Elements, ctype )
|
{
|
debuginfo( 'Activating campaign ', ctype.Name() );
|
ctype.IsActive( true );
|
}
|
}
|
mp.Optimization().CampaignCombiGeneration().OptCampaign().SetIsActiveStatusCombis( rcm.OptionActiveWindowSizeCampaignOptimization(), this );
|
}
|
*]
|
InterfaceProperties { Accessibility: 'Module' }
|
}
|