Could you explain to me what CP-SAT does when it created the goal function? With big models this action is very slow. the function is the following:
sum(sum(self.suggested_decisions[r][d]*(
((int(self.scenario.dataset['CAPITAL'][r])*self.scenario.dataset['BandA'][r]*self.scenario.dataset['SCORE_CLASS_1'][r]*int(self.scenario.constants['scaling_factor']*self.scenario.constants['recovery_rate_CA_S1'])*self.scenario.decisions[d].attributes['max_capital_recoverable']-int(self.scenario.constants['scaling_factor']*self.scenario.decisions[d].attributes['FA']*self.scenario.dataset['BandA'][r]*self.scenario.dataset['SCORE_CLASS_1'][r]))+
(int(self.scenario.dataset['CAPITAL'][r])*self.scenario.dataset['BandB'][r]*self.scenario.dataset['SCORE_CLASS_1'][r]*int(self.scenario.constants['scaling_factor']*self.scenario.constants['recovery_rate_CB_S1'])*self.scenario.decisions[d].attributes['max_capital_recoverable']-int(self.scenario.constants['scaling_factor']*self.scenario.decisions[d].attributes['FB']*self.scenario.dataset['BandB'][r]*self.scenario.dataset['SCORE_CLASS_1'][r]))+
(int(self.scenario.dataset['CAPITAL'][r])*self.scenario.dataset['BandC'][r]*self.scenario.dataset['SCORE_CLASS_1'][r]*int(self.scenario.constants['scaling_factor']*self.scenario.constants['recovery_rate_CC_S1'])*self.scenario.decisions[d].attributes['max_capital_recoverable']-int(self.scenario.constants['scaling_factor']*self.scenario.decisions[d].attributes['FC']*self.scenario.dataset['BandC'][r]*self.scenario.dataset['SCORE_CLASS_1'][r]))+
(int(self.scenario.dataset['CAPITAL'][r])*self.scenario.dataset['BandD'][r]*self.scenario.dataset['SCORE_CLASS_1'][r]*int(self.scenario.constants['scaling_factor']*self.scenario.constants['recovery_rate_CD_S1'])*self.scenario.decisions[d].attributes['max_capital_recoverable']-int(self.scenario.constants['scaling_factor']*self.scenario.decisions[d].attributes['FD']*self.scenario.dataset['BandD'][r]*self.scenario.dataset['SCORE_CLASS_1'][r]))+
(int(self.scenario.dataset['CAPITAL'][r])*self.scenario.dataset['BandE'][r]*self.scenario.dataset['SCORE_CLASS_1'][r]*int(self.scenario.constants['scaling_factor']*self.scenario.constants['recovery_rate_CE_S1'])*self.scenario.decisions[d].attributes['max_capital_recoverable']-int(self.scenario.constants['scaling_factor']*self.scenario.decisions[d].attributes['FE']*self.scenario.dataset['BandE'][r]*self.scenario.dataset['SCORE_CLASS_1'][r]))+
(int(self.scenario.dataset['CAPITAL'][r])*self.scenario.dataset['BandA'][r]*self.scenario.dataset['SCORE_CLASS_2'][r]*int(self.scenario.constants['scaling_factor']*self.scenario.constants['recovery_rate_CA_S2'])*self.scenario.decisions[d].attributes['max_capital_recoverable']-int(self.scenario.constants['scaling_factor']*self.scenario.decisions[d].attributes['FA']*self.scenario.dataset['BandA'][r]*self.scenario.dataset['SCORE_CLASS_2'][r]))+
(int(self.scenario.dataset['CAPITAL'][r])*self.scenario.dataset['BandB'][r]*self.scenario.dataset['SCORE_CLASS_2'][r]*int(self.scenario.constants['scaling_factor']*self.scenario.constants['recovery_rate_CB_S2'])*self.scenario.decisions[d].attributes['max_capital_recoverable']-int(self.scenario.constants['scaling_factor']*self.scenario.decisions[d].attributes['FB']*self.scenario.dataset['BandB'][r]*self.scenario.dataset['SCORE_CLASS_2'][r]))+
(int(self.scenario.dataset['CAPITAL'][r])*self.scenario.dataset['BandC'][r]*self.scenario.dataset['SCORE_CLASS_2'][r]*int(self.scenario.constants['scaling_factor']*self.scenario.constants['recovery_rate_CC_S2'])*self.scenario.decisions[d].attributes['max_capital_recoverable']-int(self.scenario.constants['scaling_factor']*self.scenario.decisions[d].attributes['FC']*self.scenario.dataset['BandC'][r]*self.scenario.dataset['SCORE_CLASS_2'][r]))+
(int(self.scenario.dataset['CAPITAL'][r])*self.scenario.dataset['BandD'][r]*self.scenario.dataset['SCORE_CLASS_2'][r]*int(self.scenario.constants['scaling_factor']*self.scenario.constants['recovery_rate_CD_S2'])*self.scenario.decisions[d].attributes['max_capital_recoverable']-int(self.scenario.constants['scaling_factor']*self.scenario.decisions[d].attributes['FD']*self.scenario.dataset['BandD'][r]*self.scenario.dataset['SCORE_CLASS_2'][r]))+
(int(self.scenario.dataset['CAPITAL'][r])*self.scenario.dataset['BandE'][r]*self.scenario.dataset['SCORE_CLASS_2'][r]*int(self.scenario.constants['scaling_factor']*self.scenario.constants['recovery_rate_CE_S2'])*self.scenario.decisions[d].attributes['max_capital_recoverable']-int(self.scenario.constants['scaling_factor']*self.scenario.decisions[d].attributes['FE']*self.scenario.dataset['BandE'][r]*self.scenario.dataset['SCORE_CLASS_2'][r]))+
(int(self.scenario.dataset['CAPITAL'][r])*self.scenario.dataset['BandA'][r]*self.scenario.dataset['SCORE_CLASS_3'][r]*int(self.scenario.constants['scaling_factor']*self.scenario.constants['recovery_rate_CA_S3'])*self.scenario.decisions[d].attributes['max_capital_recoverable']-int(self.scenario.constants['scaling_factor']*self.scenario.decisions[d].attributes['FA']*self.scenario.dataset['BandA'][r]*self.scenario.dataset['SCORE_CLASS_3'][r]))+
(int(self.scenario.dataset['CAPITAL'][r])*self.scenario.dataset['BandB'][r]*self.scenario.dataset['SCORE_CLASS_3'][r]*int(self.scenario.constants['scaling_factor']*self.scenario.constants['recovery_rate_CB_S3'])*self.scenario.decisions[d].attributes['max_capital_recoverable']-int(self.scenario.constants['scaling_factor']*self.scenario.decisions[d].attributes['FB']*self.scenario.dataset['BandB'][r]*self.scenario.dataset['SCORE_CLASS_3'][r]))+
(int(self.scenario.dataset['CAPITAL'][r])*self.scenario.dataset['BandC'][r]*self.scenario.dataset['SCORE_CLASS_3'][r]*int(self.scenario.constants['scaling_factor']*self.scenario.constants['recovery_rate_CC_S3'])*self.scenario.decisions[d].attributes['max_capital_recoverable']-int(self.scenario.constants['scaling_factor']*self.scenario.decisions[d].attributes['FC']*self.scenario.dataset['BandC'][r]*self.scenario.dataset['SCORE_CLASS_3'][r]))+
(int(self.scenario.dataset['CAPITAL'][r])*self.scenario.dataset['BandD'][r]*self.scenario.dataset['SCORE_CLASS_3'][r]*int(self.scenario.constants['scaling_factor']*self.scenario.constants['recovery_rate_CD_S3'])*self.scenario.decisions[d].attributes['max_capital_recoverable']-int(self.scenario.constants['scaling_factor']*self.scenario.decisions[d].attributes['FD']*self.scenario.dataset['BandD'][r]*self.scenario.dataset['SCORE_CLASS_3'][r]))+
(int(self.scenario.dataset['CAPITAL'][r])*self.scenario.dataset['BandE'][r]*self.scenario.dataset['SCORE_CLASS_3'][r]*int(self.scenario.constants['scaling_factor']*self.scenario.constants['recovery_rate_CE_S3'])*self.scenario.decisions[d].attributes['max_capital_recoverable']-int(self.scenario.constants['scaling_factor']*self.scenario.decisions[d].attributes['FE']*self.scenario.dataset['BandE'][r]*self.scenario.dataset['SCORE_CLASS_3'][r]))+
(int(self.scenario.dataset['CAPITAL'][r])*self.scenario.dataset['BandA'][r]*self.scenario.dataset['SCORE_CLASS_4'][r]*int(self.scenario.constants['scaling_factor']*self.scenario.constants['recovery_rate_CA_S4'])*self.scenario.decisions[d].attributes['max_capital_recoverable']-int(self.scenario.constants['scaling_factor']*self.scenario.decisions[d].attributes['FA']*self.scenario.dataset['BandA'][r]*self.scenario.dataset['SCORE_CLASS_4'][r]))+
(int(self.scenario.dataset['CAPITAL'][r])*self.scenario.dataset['BandB'][r]*self.scenario.dataset['SCORE_CLASS_4'][r]*int(self.scenario.constants['scaling_factor']*self.scenario.constants['recovery_rate_CB_S4'])*self.scenario.decisions[d].attributes['max_capital_recoverable']-int(self.scenario.constants['scaling_factor']*self.scenario.decisions[d].attributes['FB']*self.scenario.dataset['BandB'][r]*self.scenario.dataset['SCORE_CLASS_4'][r]))+
(int(self.scenario.dataset['CAPITAL'][r])*self.scenario.dataset['BandC'][r]*self.scenario.dataset['SCORE_CLASS_4'][r]*int(self.scenario.constants['scaling_factor']*self.scenario.constants['recovery_rate_CC_S4'])*self.scenario.decisions[d].attributes['max_capital_recoverable']-int(self.scenario.constants['scaling_factor']*self.scenario.decisions[d].attributes['FC']*self.scenario.dataset['BandC'][r]*self.scenario.dataset['SCORE_CLASS_4'][r]))+
(int(self.scenario.dataset['CAPITAL'][r])*self.scenario.dataset['BandD'][r]*self.scenario.dataset['SCORE_CLASS_4'][r]*int(self.scenario.constants['scaling_factor']*self.scenario.constants['recovery_rate_CD_S4'])*self.scenario.decisions[d].attributes['max_capital_recoverable']-int(self.scenario.constants['scaling_factor']*self.scenario.decisions[d].attributes['FD']*self.scenario.dataset['BandD'][r]*self.scenario.dataset['SCORE_CLASS_4'][r]))+
(int(self.scenario.dataset['CAPITAL'][r])*self.scenario.dataset['BandE'][r]*self.scenario.dataset['SCORE_CLASS_4'][r]*int(self.scenario.constants['scaling_factor']*self.scenario.constants['recovery_rate_CE_S4'])*self.scenario.decisions[d].attributes['max_capital_recoverable']-int(self.scenario.constants['scaling_factor']*self.scenario.decisions[d].attributes['FE']*self.scenario.dataset['BandE'][r]*self.scenario.dataset['SCORE_CLASS_4'][r]))+
(int(self.scenario.dataset['CAPITAL'][r])*self.scenario.dataset['BandA'][r]*self.scenario.dataset['SCORE_CLASS_5'][r]*int(self.scenario.constants['scaling_factor']*self.scenario.constants['recovery_rate_CA_S5'])*self.scenario.decisions[d].attributes['max_capital_recoverable']-int(self.scenario.constants['scaling_factor']*self.scenario.decisions[d].attributes['FA']*self.scenario.dataset['BandA'][r]*self.scenario.dataset['SCORE_CLASS_5'][r]))+
(int(self.scenario.dataset['CAPITAL'][r])*self.scenario.dataset['BandB'][r]*self.scenario.dataset['SCORE_CLASS_5'][r]*int(self.scenario.constants['scaling_factor']*self.scenario.constants['recovery_rate_CB_S5'])*self.scenario.decisions[d].attributes['max_capital_recoverable']-int(self.scenario.constants['scaling_factor']*self.scenario.decisions[d].attributes['FB']*self.scenario.dataset['BandB'][r]*self.scenario.dataset['SCORE_CLASS_5'][r]))+
(int(self.scenario.dataset['CAPITAL'][r])*self.scenario.dataset['BandC'][r]*self.scenario.dataset['SCORE_CLASS_5'][r]*int(self.scenario.constants['scaling_factor']*self.scenario.constants['recovery_rate_CC_S5'])*self.scenario.decisions[d].attributes['max_capital_recoverable']-int(self.scenario.constants['scaling_factor']*self.scenario.decisions[d].attributes['FC']*self.scenario.dataset['BandC'][r]*self.scenario.dataset['SCORE_CLASS_5'][r]))+
(int(self.scenario.dataset['CAPITAL'][r])*self.scenario.dataset['BandD'][r]*self.scenario.dataset['SCORE_CLASS_5'][r]*int(self.scenario.constants['scaling_factor']*self.scenario.constants['recovery_rate_CD_S5'])*self.scenario.decisions[d].attributes['max_capital_recoverable']-int(self.scenario.constants['scaling_factor']*self.scenario.decisions[d].attributes['FD']*self.scenario.dataset['BandD'][r]*self.scenario.dataset['SCORE_CLASS_5'][r]))+
(int(self.scenario.dataset['CAPITAL'][r])*self.scenario.dataset['BandE'][r]*self.scenario.dataset['SCORE_CLASS_5'][r]*int(self.scenario.constants['scaling_factor']*self.scenario.constants['recovery_rate_CE_S5'])*self.scenario.decisions[d].attributes['max_capital_recoverable']-int(self.scenario.constants['scaling_factor']*self.scenario.decisions[d].attributes['FE']*self.scenario.dataset['BandE'][r]*self.scenario.dataset['SCORE_CLASS_5'][r]))+
(int(self.scenario.dataset['CAPITAL'][r])*self.scenario.dataset['BandA'][r]*self.scenario.dataset['SCORE_CLASS_6'][r]*int(self.scenario.constants['scaling_factor']*self.scenario.constants['recovery_rate_CA_S6'])*self.scenario.decisions[d].attributes['max_capital_recoverable']-int(self.scenario.constants['scaling_factor']*self.scenario.decisions[d].attributes['FA']*self.scenario.dataset['BandA'][r]*self.scenario.dataset['SCORE_CLASS_6'][r]))+
(int(self.scenario.dataset['CAPITAL'][r])*self.scenario.dataset['BandB'][r]*self.scenario.dataset['SCORE_CLASS_6'][r]*int(self.scenario.constants['scaling_factor']*self.scenario.constants['recovery_rate_CB_S6'])*self.scenario.decisions[d].attributes['max_capital_recoverable']-int(self.scenario.constants['scaling_factor']*self.scenario.decisions[d].attributes['FB']*self.scenario.dataset['BandB'][r]*self.scenario.dataset['SCORE_CLASS_6'][r]))+
(int(self.scenario.dataset['CAPITAL'][r])*self.scenario.dataset['BandC'][r]*self.scenario.dataset['SCORE_CLASS_6'][r]*int(self.scenario.constants['scaling_factor']*self.scenario.constants['recovery_rate_CC_S6'])*self.scenario.decisions[d].attributes['max_capital_recoverable']-int(self.scenario.constants['scaling_factor']*self.scenario.decisions[d].attributes['FC']*self.scenario.dataset['BandC'][r]*self.scenario.dataset['SCORE_CLASS_6'][r]))+
(int(self.scenario.dataset['CAPITAL'][r])*self.scenario.dataset['BandD'][r]*self.scenario.dataset['SCORE_CLASS_6'][r]*int(self.scenario.constants['scaling_factor']*self.scenario.constants['recovery_rate_CD_S6'])*self.scenario.decisions[d].attributes['max_capital_recoverable']-int(self.scenario.constants['scaling_factor']*self.scenario.decisions[d].attributes['FD']*self.scenario.dataset['BandD'][r]*self.scenario.dataset['SCORE_CLASS_6'][r]))+
(int(self.scenario.dataset['CAPITAL'][r])*self.scenario.dataset['BandE'][r]*self.scenario.dataset['SCORE_CLASS_6'][r]*int(self.scenario.constants['scaling_factor']*self.scenario.constants['recovery_rate_CE_S6'])*self.scenario.decisions[d].attributes['max_capital_recoverable']-int(self.scenario.constants['scaling_factor']*self.scenario.decisions[d].attributes['FE']*self.scenario.dataset['BandE'][r]*self.scenario.dataset['SCORE_CLASS_6'][r])))
*(1*self.scenario.constants['scaling_factor']-int(self.scenario.constants['scaling_factor']*self.scenario.dataset['SCORE'][r]))
)for r in self.all_records) for d in self.all_decisions)
Where all self.all_records=60.000 and self.all_decisions=7
The language is python.