diff --git a/.github/test_real.sh b/.github/test_real.sh index 4af0258e2..d624a7459 100755 --- a/.github/test_real.sh +++ b/.github/test_real.sh @@ -11,4 +11,4 @@ cd tests # we have to copy over the coveragerc file to make sure it's in the # same directory where codecov is run cp ../.coveragerc . -testflo --pre_announce --disallow_deprecations -v --coverage --coverpkg pyoptsparse $EXTRA_FLAGS +testflo -i --pre_announce --disallow_deprecations -v --coverage --coverpkg pyoptsparse $EXTRA_FLAGS diff --git a/.github/workflows/linux-build.yml b/.github/workflows/linux-build.yml index 0e4e28295..ba4f70a65 100644 --- a/.github/workflows/linux-build.yml +++ b/.github/workflows/linux-build.yml @@ -31,4 +31,4 @@ jobs: - name: Run tests run: | cd tests - testflo --pre_announce -v -n 1 . + testflo -i --pre_announce -v -n 1 . diff --git a/.github/workflows/windows-build.yml b/.github/workflows/windows-build.yml index 440fee202..54b3e1093 100644 --- a/.github/workflows/windows-build.yml +++ b/.github/workflows/windows-build.yml @@ -52,4 +52,4 @@ jobs: run: | conda activate pyos-build cd tests - testflo --pre_announce -v -n 1 . + testflo -i --pre_announce -v -n 1 . diff --git a/pyoptsparse/pyNSGA2/pyNSGA2.py b/pyoptsparse/pyNSGA2/pyNSGA2.py index 8bd340ed0..12a0d5987 100644 --- a/pyoptsparse/pyNSGA2/pyNSGA2.py +++ b/pyoptsparse/pyNSGA2/pyNSGA2.py @@ -34,6 +34,9 @@ def __init__(self, raiseError=True, options={}): if isinstance(nsga2, str) and raiseError: raise ImportError(nsga2) + if self.getOption("PopSize") % 4 != 0: + raise ValueError("Option 'PopSize' must be a multiple of 4") + @staticmethod def _getInforms(): informs = {} diff --git a/pyoptsparse/pyNSGA2/source/allocate.c b/pyoptsparse/pyNSGA2/source/allocate.c index 271d9069d..993bfe056 100644 --- a/pyoptsparse/pyNSGA2/source/allocate.c +++ b/pyoptsparse/pyNSGA2/source/allocate.c @@ -30,7 +30,7 @@ void allocate_memory_ind (individual *ind, Global global) if (global.nbin != 0) { ind->xbin = (double *)malloc(global.nbin*sizeof(double)); - ind->gene = (int **)malloc(global.nbin*sizeof(int)); + ind->gene = (int **)malloc(global.nbin*sizeof(int *)); for (j=0; jgene[j] = (int *)malloc(global.nbits[j]*sizeof(int)); diff --git a/pyoptsparse/pyNSGA2/source/crowddist.c b/pyoptsparse/pyNSGA2/source/crowddist.c index 4b33b4cc1..7332216b4 100644 --- a/pyoptsparse/pyNSGA2/source/crowddist.c +++ b/pyoptsparse/pyNSGA2/source/crowddist.c @@ -26,7 +26,7 @@ void assign_crowding_distance_list (population *pop, list *lst, int front_size, pop->ind[lst->child->index].crowd_dist = INF; return; } - obj_array = (int **)malloc(global.nobj*sizeof(int)); + obj_array = (int **)malloc(global.nobj*sizeof(int *)); dist = (int *)malloc(front_size*sizeof(int)); for (i=0; iind[c2].crowd_dist = INF; return; } - obj_array = (int **)malloc(global.nobj*sizeof(int)); + obj_array = (int **)malloc(global.nobj*sizeof(int *)); dist = (int *)malloc(front_size*sizeof(int)); for (i=0; i