'Why docplex optimization gives no answer

I am working on an optimizatiom model which is set to maximize NPV. I am getting some results, however my cap_ele should represent the max value in the el_to_ele_t series. However after running the code both int cap_ele and series el_to_ele_t reamin at 0. Below are my variables:

        prod_hpp_grid_t = mdl.continuous_var_dict(time, lb=0, ub=cap_grid, name='Power sold to grid')
        prod_h2_t       = mdl.continuous_var_dict(time, lb=0, name='Hydrogen output') 
        P_curt          = mdl.continuous_var_dict(time, lb=0, name='Curtailment')
        el_to_ele_t     = mdl.continuous_var_dict(time, lb=0, name='El consumption from Electrolyser')

        cap_wtg = mdl.integer_var(lb=0, name='Wind capacity')
        cap_pv = mdl.integer_var(lb=0, name='Solar capacity')
        cap_ele = mdl.integer_var(lb=0, name= "Electrolysis capacity")

And here is the objective function:

mdl.maximize(
              -(cost_invest_wtg * cap_wtg + \
              cost_invest_pv * cap_pv + \
              cost_invest_ele * cap_ele + \
            mdl.sum(
                (mdl.sum(
                    price_spot[t] * prod_hpp_grid_t[t] + \
                    price_h2s[t] * prod_h2_t[t]  for t in time) -\
                   (cost_onm_wtg * cap_wtg + \
                    cost_onm_pv * cap_pv + \
                    cost_onm_ele * cap_ele) 
                 ) / np.power(1 + discount_f, i)
                for i in range(1, life_t_hpp + 1)
            )
        )

And those are contraints and the solver:

for t in time:

            mdl.add_constraint(prod_hpp_grid_t[t] == prod_wtg_t[t] * cap_wtg + prod_pv_t[t] * cap_pv - P_curt[t] - el_to_ele_t[t] )                              
            mdl.add_constraint(prod_h2_t[t]       == el_to_ele_t[t] * cons_el_kg_ele)     
            mdl.add_constraint(cap_ele             >= el_to_ele_t[t])

        ######### Solving the problem
        sol = mdl.solve(log_output=False)

        prod_hpp_grid_ts = pd.DataFrame.from_dict(sol.get_value_dict(prod_hpp_grid_t), orient='index')
        prod_hpp_grid_ts = prod_hpp_grid_ts.reset_index()   
        
        P_curt = pd.DataFrame.from_dict(sol.get_value_dict(P_curt), orient='index')
        P_curt = P_curt.reset_index()
        
        prod_h2_ts = pd.DataFrame.from_dict(sol.get_value_dict(prod_h2_t), orient='index')
        prod_h2_ts = prod_h2_ts.reset_index()   
        
        el_to_ele_ts = pd.DataFrame.from_dict(sol.get_value_dict(el_to_ele_t), orient='index')
        el_to_ele_ts = el_to_ele_ts.reset_index()  

Could there be any reson for why im not getting the desired answer?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source