Skip to content

Instantly share code, notes, and snippets.

View dhadka's full-sized avatar

David Hadka dhadka

  • Microsoft, GitHub
  • Fort Collins, CO
View GitHub Profile
@dhadka
dhadka / salib_ex.py
Created July 31, 2015 18:21
SALib with Executioner Example
from executioner.salib import *
from SALib.sample import saltelli
from SALib.analyze import sobol
problem = {
'num_vars': 11,
'names': ['x1', 'x2', 'x3', 'x4', 'x5', 'x6', 'x7', 'x8', 'x9', 'x10', 'x11'],
'bounds': [[0, 1], [0, 1], [0, 1], [0, 1], [0, 1], [0, 1], [0, 1], [0, 1],
[0, 1], [0, 1], [0, 1]]
}
@dhadka
dhadka / IslandModel.java
Last active September 21, 2015 19:02
Temporary fix to a bug in the island model example, where TimSort throws an exception indicating the comparator's contract is violated
import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Properties;
import java.util.concurrent.Semaphore;
import org.apache.commons.math3.random.MersenneTwister;
import org.apache.commons.math3.random.RandomAdaptor;
import org.apache.commons.math3.random.SynchronizedRandomGenerator;
@dhadka
dhadka / demo.ipynb
Last active March 1, 2021 14:03
Simple Platypus Demo
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dhadka
dhadka / ScaledProblem.java
Created December 1, 2015 17:45
Scaled Problem
public class ScaledProblem implements Problem {
private final Problem problem;
private final double[] factors;
public ScaledProblem(Problem problem, double base) {
super();
this.problem = problem;
@dhadka
dhadka / NSGAIII-Example.java
Last active December 20, 2015 15:38
Creating an instance of NSGA-III
private Algorithm newNSGAIII(TypedProperties properties, Problem problem) {
int divisionsOuter = 4;
int divisionsInner = 0;
if (properties.contains("divisionsOuter") && properties.contains("divisionsInner")) {
divisionsOuter = (int)properties.getDouble("divisionsOuter", 4);
divisionsInner = (int)properties.getDouble("divisionsInner", 0);
} else if (properties.contains("divisions")){
divisionsOuter = (int)properties.getDouble("divisions", 4);
} else if (problem.getNumberOfObjectives() == 1) {
@dhadka
dhadka / Rhodium.ipynb
Last active September 27, 2019 05:34
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
// FPGAFitnessComparator.java
//
// Author:
// Antonio J. Nebro <antonio@lcc.uma.es>
// Juan J. Durillo <durillo@lcc.uma.es>
//
// Copyright (c) 2011 Antonio J. Nebro, Juan J. Durillo
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ExecutionException;
@dhadka
dhadka / RuntimeApproximationSets.java
Created July 27, 2016 12:22
RuntimeApproximationSets.java
Instrumenter instrumenter = new Instrumenter()
.withProblem("UF1")
.withFrequency(100)
.attachApproximationSetCollector();
new Executor()
.withProblem("UF1")
.withAlgorithm("NSGAII")
.withMaxEvaluations(10000)
.withInstrumenter(instrumenter)
@dhadka
dhadka / ExampleSinglePointBinaryCrossover.java
Created July 27, 2016 12:50
Demonstrates creating a new operator within the MOEA Framework
/* Copyright 2009-2016 David Hadka
*
* This file is part of the MOEA Framework.
*
* The MOEA Framework is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* The MOEA Framework is distributed in the hope that it will be useful, but