'PyGMO fitness constraints modelling

Dears,

I am new in PyGMO and I was trying to model my optimization problem to execute a co-simulation with PowerFactory.

Actually, my model "is working" (it provides a results), but it doesn't fulfill some constraints that I defined. Therefore, I was wondering if this code:

class ASM_model:
    def fitness(self,x):
        pasm_g = x[(0):(nGen)] 
        a_g = x[nGen:(2*nGen)] # BINARY
        P_min_cons = []
        for g in range(nGen):
            P_min_cons.append(Pmin[g]*a_g[g] - pasm_g[g] - p_dam_h[g]) # INEQUALTY

(Pmin[g] and p_dam_h[g] are parameters)

provides nGen inequalty constraints, as follows:

Pmin[g]*x[g+nGen] - pasm_g[g] - x[g] <=0

if I define

# Define the number of inequality constraints 
    def get_nic(self):
        return nGen

Because when I print my problem the constraints' number is as expected, but I want to be sure that I am properly modelling them.

I hope I have explained this as best I can. Thanks in advance for your support.



Sources

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

Source: Stack Overflow

Solution Source