A Free and Open Source Python Library for Multiobjective Optimization

Overview

Platypus

GitHub Actions status Documentation Status

What is Platypus?

Platypus is a framework for evolutionary computing in Python with a focus on multiobjective evolutionary algorithms (MOEAs). It differs from existing optimization libraries, including PyGMO, Inspyred, DEAP, and Scipy, by providing optimization algorithms and analysis tools for multiobjective optimization. It currently supports NSGA-II, NSGA-III, MOEA/D, IBEA, Epsilon-MOEA, SPEA2, GDE3, OMOPSO, SMPSO, and Epsilon-NSGA-II. For more information, see our IPython Notebook or our online documentation.

Example

For example, optimizing a simple biobjective problem with a single real-valued decision variables is accomplished in Platypus with:

    from platypus import NSGAII, Problem, Real

    def schaffer(x):
        return [x[0]**2, (x[0]-2)**2]

    problem = Problem(1, 2)
    problem.types[:] = Real(-10, 10)
    problem.function = schaffer

    algorithm = NSGAII(problem)
    algorithm.run(10000)

Installation

To install the latest Platypus release, run the following command:

    pip install platypus-opt

To install the latest development version of Platypus, run the following commands:

    git clone https://github.com/Project-Platypus/Platypus.git
    cd Platypus
    python setup.py install

Anaconda

Platypus is also available via conda-forge.

    conda config --add channels conda-forge
    conda install platypus-opt

For more information see the feedstock located here.

License

Platypus is released under the GNU General Public License.

Comments
  • Experimenter using own problem

    Experimenter using own problem

    Hi there,

    I was just wondering how to use the experimenter using ones own problem rather than a predefined problem?

    Run the algorithm

    N = 2000 problem = Problem(multiple_days_assigned_size, 2, 2) problem.directions[1] = Problem.MINIMIZE problem.directions[0] = Problem.MAXIMIZE problem.constraints[:] = ">=0" problem.types[:] = Integer(0, my_counter_again - 1) problem.function = lambda x: evaluation_function2(x, jobs, c_time_added_up, total_allowed_time_all_jobs, extra_time) algorithm = NSGAII(problem) algorithm.run(N) feasible_solutions_total = [s for s in algorithm.result if s.feasible] Nondominated_solutions_total = nondominated(algorithm.result)

    calculate the difference in models nsga2 and nsga3

    if name == "main": algorithms = [NSGAII, (NSGAIII, {"divisions_outer":12})] problems = [Problem(multiple_days_assigned_size, 2, 2)] #what would I put in here?

    # run the experiment
    results = experiment(algorithms, problems, nfe=10000, seeds=10)
    

    Any tips would be greatly appreciated!

    Thanks

    opened by sabrinadraude 12
  • Example in README.md not working when platypus was installed using pip

    Example in README.md not working when platypus was installed using pip

    The given example in README.md for a biobjective problem doesn't work when platypus was installed using pip.

    from platypus import NSGAII, Problem, Real This leads to the error ImportError: cannot import name 'NSGAII'

    The correct form is:

    from platypus.problems import Problem
    from platypus.algorithms import NSGAII
    from platypus.types import Real
    
    opened by johanneskind 11
  • Error while running ProcessPoolEvaluator in iPython

    Error while running ProcessPoolEvaluator in iPython

    While running ProcessPoolEvaluator in Windows iPython environment, I have the following error.

    BrokenProcessPool: A process in the process pool was terminated abruptly while the future was running or pending.

    Stale 
    opened by rebinth 11
  • Is it possible to run 'hyp.calculate' on individual instances of 'algorithm.result'?

    Is it possible to run 'hyp.calculate' on individual instances of 'algorithm.result'?

    Hi David,

    I have the following code:

    random.seed(1969)

    def inverse_third_layer(x): b= inverse_desired_output
    W= weights_third_layer bias= third_layer_bias

    return [np.sum(W[0,:])*x[0] - np.sum(b + bias), np.sum(W[1,:])*x[1] - np.sum(b + bias), np.sum(W[2,:])*x[2] - np.sum(b + bias), np.sum(W[3,:])*x[3] - np.sum(b + bias), 
            np.sum(W[4,:])*x[4] - np.sum(b + bias), np.sum(W[5,:])*x[5] - np.sum(b + bias), np.sum(W[6,:])*x[6] - np.sum(b + bias), np.sum(W[7,:])*x[7] - np.sum(b + bias)], [x[0], 
                  x[1], x[2], x[3], x[4], x[5], x[6], x[7]]
    

    problem= Problem(8, 8, 8)

    problem.types[:]= Real(0, 1) problem.constraints[:]= ">=0" problem.constraints[:]= "<=1" problem.function= inverse_third_layer

    algorithm= NSGAII(problem, population_size= 50, variator= UNDX()) algorithm.run(1000)

    From it, I get a population of 50 feasible solutions. I would like to compare each objective vector by using the Hypervolume function. For that, I was hoping to iterate through each population to compute the Hypervolume as follows: hyp= Hypervolume(minimum= [0,0,0,0,0,0,0,0], maximum= [2,2,2,2,2,2,2,2]) hyp_result= hyp.calculate(algorithm.result[0])

    which gives this error message: TypeError: 'Solution' object is not iterable

    Do you have any suggestions?

    Many thanks, Ivan

    opened by ivan-marroquin 11
  • Parallelization not finishing

    Parallelization not finishing

    Hi,

    I have been using the parallelization aspect of Platypus. However the code never finishes, after hours of leaving it to run. I'm not sure if there is something else I need to download?

    problem = Problem(multiple_days_assigned_size, 2, 2)
    problem.directions[1] = Problem.MINIMIZE
    problem.directions[0] = Problem.MINIMIZE
    problem.constraints[:] = ">=0"
    problem.types[:] = Integer(0, my_counter_again - 1)
    problem.function = lambda x: evaluation_function2(x, jobs, c_time_added_up, total_allowed_time_all_jobs,
                                                      extra_time)
    
    # calculate the difference in models nsga2 and nsga3
    if __name__ == "__main__":
        algorithms = [NSGAII, (NSGAIII, {"divisions_outer":12})]
        with ProcessPoolEvaluator(4) as evaluator:
            results = experiment(algorithms, [problem], nfe=2, evaluator=evaluator)
    
            # Calculate the hypervolume using assigned objective max and mins for comparing algorithms
            min_pri = 0
            min_cost = multiple_days_assigned_size * 30
            max_pri = multiple_days_assigned_size * 6.53
            max_cost = multiple_days_assigned_size * 130
    
            # calculate the hypervolume indicator between the algorithms
            hyp = Hypervolume(minimum=[min_pri, min_cost], maximum=[max_pri, max_cost])
            hyp_result = calculate(results, hyp, evaluator=evaluator)
            display(hyp_result, ndigits=3)
    
    
    Stale 
    opened by sabrinadraude 10
  • How to implement a multiobjective TSP?

    How to implement a multiobjective TSP?

    Hi everyone,

    This question is a rather long one. It is referring to this example code: https://github.com/Project-Platypus/Platypus/blob/master/examples/tsp.py

    I am working on a multiobjective TSP model where the salesman can choose between bus or flight to go from city i to j. The two conflicting objectives are to minimise travelling time and carbon emissions. This would be applicable to a tourist doing a citytrip, the tourist has the choice whether to go by plane (fast but carbon intensive) or by bus (slow but green).

    I created my own "distance matrices" for carbon emissions and traveling time for 6 cities. This dataset I would like to feed the NSGA-II algorithm to find out the non-dominated solutions. Below is just the carbon emission matrix:

    carbon_bus = {'Berlin': [999999.0, 4.58, 8.31, 20.71, 35.65, 13.89], 
                  'Dresden': [4.58, 999999.0, 3.54, 15.96, 32.68, 10.92], 
                  'Prague': [8.31, 3.54, 999999.0, 12.47, 30.88, 9.1], 
                  'Budapest': [20.71, 15.96, 12.47, 999999.0, 28.83, 15.48], 
                  'Rome': [35.65, 32.68, 30.88, 28.83, 999999.0, 21.73], 
                  'Munich': [13.89, 10.92, 9.1, 15.48, 21.73, 999999.0]}
    
    carbon_bus = pd.DataFrame(carbon_bus)
    carbon_bus["carbon_bus(kg CO2)"] = ["Berlin","Dresden","Prague","Budapest","Rome","Munich"]
    carbon_bus = carbon_bus.set_index("carbon_bus(kg CO2)")
    print(carbon_bus)
    
    

    I tried writing my emissions function based on the tsp()-function from the example code (https://github.com/Project-Platypus/Platypus/blob/master/examples/tsp.py):

    def emissions(x):
        em = 0
        tour = x[0]
        for i in range(len(tour)-1):
            em = em + carbon_bus.iloc[tour[i],tour[i+1%len(tour)]]
        return em
    

    I tried to feed this function into the solver but failed to get a reasonable solution:

    problem = Problem(1, 1)
    problem.types[0] = Permutation(range(len(6))) 
    problem.directions[0] = Problem.MINIMIZE
    problem.function = emissions
    algorithm = GeneticAlgorithm(problem)
    algorithm.run(1000, callback = lambda a : print(a.nfe, unique(nondominated(algorithm.result))[0]))
    

    Questions:

    1. How can I minimise the carbon objective by referring to the matrix given above?
    2. Also, I don't know how to understand the line with tour=x[0] which I have taken from the tsp()-function. Is this referring to the decision variable x_ij?
    3. How would you propose to implement a multiobjective TSP in playtypus?

    Thanks in advance Kevin

    For more information on my model you can refer to my question in OR-Stackexchange: https://or.stackexchange.com/q/3933/3385

    Stale 
    opened by grafkevin 10
  • Integers and Multi-Objective with Particle Swarm

    Integers and Multi-Objective with Particle Swarm

    Trying to run the following problem with two objectives, three variables, no constraints and Integer variables with SMPSO:

    from platypus import *
    
    def my_function(x):
        """ Some objective function"""
        return [-x[0] ** 2 - x[2] ** 2, x[1] - x[0]]
    
    def AsInteger():
    
        problem = Problem(3, 2)  # define 3 inputs and 1 objective (and no constraints)
        problem.directions[:] = Problem.MAXIMIZE
        int1 = Integer(-50, 50)
        int2 = Integer(-50, 50)
        int3 = Integer(-50, 50)
        problem.types[:] = [int1, int2, int3]
        problem.function = my_function
        algorithm = SMPSO(problem)
        algorithm.run(10000)
    

    I get:

    Traceback (most recent call last): File "D:\MyProjects\Drilling\test_platypus.py", line 62, in AsInteger() File "D:\MyProjects\Drilling\test_platypus.py", line 19, in AsInteger algorithm.run(10000) File "build\bdist.win-amd64\egg\platypus\core.py", line 405, in run File "build\bdist.win-amd64\egg\platypus\algorithms.py", line 820, in step File "build\bdist.win-amd64\egg\platypus\algorithms.py", line 838, in iterate File "build\bdist.win-amd64\egg\platypus\algorithms.py", line 1008, in _update_velocities TypeError: unsupported operand type(s) for -: 'list' and 'list'

    With OMOPSO:

    Traceback (most recent call last): File "D:\MyProjects\Drilling\test_platypus.py", line 62, in AsInteger() File "D:\MyProjects\Drilling\test_platypus.py", line 19, in AsInteger algorithm.run(10000) File "build\bdist.win-amd64\egg\platypus\core.py", line 405, in run File "build\bdist.win-amd64\egg\platypus\algorithms.py", line 941, in step File "build\bdist.win-amd64\egg\platypus\algorithms.py", line 949, in initialize File "build\bdist.win-amd64\egg\platypus\core.py", line 818, in iadd File "build\bdist.win-amd64\egg\platypus\core.py", line 785, in add File "build\bdist.win-amd64\egg\platypus\core.py", line 707, in compare KeyError: 0

    With CMAES:

    Traceback (most recent call last): File "D:\MyProjects\Drilling\test_platypus.py", line 62, in AsInteger() File "D:\MyProjects\Drilling\test_platypus.py", line 19, in AsInteger algorithm.run(10000) File "build\bdist.win-amd64\egg\platypus\core.py", line 405, in run File "build\bdist.win-amd64\egg\platypus\algorithms.py", line 1074, in step File "build\bdist.win-amd64\egg\platypus\algorithms.py", line 1134, in initialize File "build\bdist.win-amd64\egg\platypus\algorithms.py", line 1298, in iterate File "build\bdist.win-amd64\egg\platypus\core.py", line 378, in evaluate_all File "build\bdist.win-amd64\egg\platypus\evaluator.py", line 88, in evaluate_all File "build\bdist.win-amd64\egg\platypus\evaluator.py", line 55, in run_job File "build\bdist.win-amd64\egg\platypus\core.py", line 345, in run File "build\bdist.win-amd64\egg\platypus\core.py", line 518, in evaluate File "build\bdist.win-amd64\egg\platypus\core.py", line 160, in call File "build\bdist.win-amd64\egg\platypus\types.py", line 147, in decode

    File "build\bdist.win-amd64\egg\platypus\tools.py", line 521, in gray2bin TypeError: 'float' object has no attribute 'getitem'

    With GDE3:

    Traceback (most recent call last): File "D:\MyProjects\Drilling\test_platypus.py", line 62, in AsInteger() File "D:\MyProjects\Drilling\test_platypus.py", line 19, in AsInteger algorithm.run(10000) File "build\bdist.win-amd64\egg\platypus\core.py", line 405, in run File "build\bdist.win-amd64\egg\platypus\algorithms.py", line 67, in step File "build\bdist.win-amd64\egg\platypus\algorithms.py", line 323, in iterate File "build\bdist.win-amd64\egg\platypus\operators.py", line 258, in evolve TypeError: float() argument must be a string or a number

    It works fine with NSGAII, for example. Am I missing something fundamental? My apologies if this limitation is mentioned somewhere, I wasn't able to find it anywhere.

    Thank you.

    Andrea.

    Stale 
    opened by infinity77 9
  • A proper release would be useful

    A proper release would be useful

    Thanks for creating Platypus.

    I've started successfully using Platypus for some simple optimizations. In order to communicate to other people which version of Platypus I'm using (particularly in code that I develop), it would be really useful to have a proper release to reference. Failing that, at least a version number within the code itself would help.

    opened by mhucka 9
  • Problem with MPI

    Problem with MPI

    Hi!

    I am trying to distribute the fitness evaluations using the MPIPool facility. Unfortunately, my code crashes with the following error message:

    Traceback (most recent call last):
      File "main_mpi.py", line 125, in invoke_master
        engine.run(ITERATIONS*INDIVIDUALS) 
      File "build/bdist.linux-i686/egg/platypus/core.py", line 304, in run
      File "build/bdist.linux-i686/egg/platypus/algorithms.py", line 173, in step
      File "build/bdist.linux-i686/egg/platypus/algorithms.py", line 183, in initialize
      File "build/bdist.linux-i686/egg/platypus/algorithms.py", line 72, in initialize
      File "build/bdist.linux-i686/egg/platypus/core.py", line 277, in evaluate_all
      File "build/bdist.linux-i686/egg/platypus/evaluator.py", line 88, in evaluate_all
      File "build/bdist.linux-i686/egg/platypus/mpipool.py", line 195, in map
      File "mpi4py/MPI/Comm.pyx", line 1173, in mpi4py.MPI.Comm.recv
      File "mpi4py/MPI/msgpickle.pxi", line 303, in mpi4py.MPI.PyMPI_recv
      File "mpi4py/MPI/msgpickle.pxi", line 269, in mpi4py.MPI.PyMPI_recv_match
      File "mpi4py/MPI/msgpickle.pxi", line 111, in mpi4py.MPI.Pickle.load
      File "mpi4py/MPI/msgpickle.pxi", line 100, in mpi4py.MPI.Pickle.cloads
    TypeError: ('__init__() takes exactly 2 arguments (1 given)', <class 'platypus.mpipool.MPIPoolException'>, ())
    

    I am surely missing something. Do you have any suggestions or insights about the cause? I'll try to provide a minimal example of my code, if necessary.

    Thank you!

    Stale 
    opened by aresio 8
  • CompoundOperator with multiparent variators and Subsets

    CompoundOperator with multiparent variators and Subsets

    Hi,

    So I have a problem setup with multiple types, Real and Subset. I was wondering if I can use the Multiparent Variator for the Reals ? I tried the line below :

    operators = CompoundOperator(SSX(probability=0.1), SPX(nparents=4,noffspring=2), Replace(probability=0.01), PM(probability=0.01))

    And got an error like unexpected number of offspring, expected 2, received 3.

    Is it even possible to combine these operators or I would have to stick to SBX() for Reals?

    Thanks!

    opened by mronda 7
  • Max number of functions evaluations doesn't behave as expected with InjectedPopulation

    Max number of functions evaluations doesn't behave as expected with InjectedPopulation

    Hello, The following code doesn't work as expected :

    from platypus import (OMOPSO,
                          Problem,
                          Real,
                          InjectedPopulation)
    
    
    def schaffer(x):
        return [x[0]**3, (x[0]-2)**3]
    
    
    def callback_function(algorithm):
        print(algorithm.nfe)
    
    
    problem = Problem(1, 2)
    problem.types[:] = Real(-10, 10)
    problem.function = schaffer
    
    algorithm = OMOPSO(problem,
                       swarm_size=20,
                       epsilons=[0.05, 0.05])
    algorithm.run(5000,
                  callback = callback_function)
    
    init_pop = algorithm.result
    
    
    algorithm2 = OMOPSO(problem,
                        generator=InjectedPopulation(init_pop),
                        swarm_size=20,
                        epsilons=[0.05, 0.05])
    
    algorithm2.run(5000,
                   callback = callback_function)
    
    

    I expected a result like :

    20
    40
    60
    ....
    5000
    
    20
    40
    ...
    5000
    

    but instead i got :

    20
    40
    60
    ....
    5000
    
    19
    39
    59
    ...
    5019
    

    But it works as expected when i use the usual shaffer function :

    def schaffer(x):
        return [x[0]**2, (x[0]-2)**2]
    

    My problem is that my cost function takes a long time to compute and i can't afford to make more functions evaluations than expected.

    opened by Orbitography 7
  • Bump actions/stale from 6 to 7

    Bump actions/stale from 6 to 7

    Bumps actions/stale from 6 to 7.

    Release notes

    Sourced from actions/stale's releases.

    v7.0.0

    ⚠️ This version contains breaking changes ⚠️

    What's Changed

    Breaking Changes

    • In this release we prevent this action from managing the stale label on items included in exempt-issue-labels and exempt-pr-labels
    • We decided that this is outside of the scope of this action, and to be left up to the maintainer

    New Contributors

    Full Changelog: https://github.com/actions/stale/compare/v6...v7.0.0

    v6.0.1

    Update @​actions/core to 1.10.0 #839

    Full Changelog: https://github.com/actions/stale/compare/v6.0.0...v6.0.1

    Changelog

    Sourced from actions/stale's changelog.

    Changelog

    [7.0.0]

    :warning: Breaking change :warning:

    [6.0.1]

    Update @​actions/core to v1.10.0 (#839)

    [6.0.0]

    :warning: Breaking change :warning:

    Issues/PRs default close-issue-reason is now not_planned(#789)

    [5.1.0]

    Don't process stale issues right after they're marked stale [Add close-issue-reason option]#764#772 Various dependabot/dependency updates

    4.1.0 (2021-07-14)

    Features

    4.0.0 (2021-07-14)

    Features

    Bug Fixes

    • dry-run: forbid mutations in dry-run (#500) (f1017f3), closes #499
    • logs: coloured logs (#465) (5fbbfba)
    • operations: fail fast the current batch to respect the operations limit (#474) (5f6f311), closes #466
    • label comparison: make label comparison case insensitive #517, closes #516
    • filtering comments by actor could have strange behavior: "stale" comments are now detected based on if the message is the stale message not who made the comment(#519), fixes #441, #509, #518

    Breaking Changes

    ... (truncated)

    Commits
    • 6f05e42 draft release for v7.0.0 (#888)
    • eed91cb Update how stale handles exempt items (#874)
    • 10dc265 Merge pull request #880 from akv-platform/update-stale-repo
    • 9c1eb3f Update .md files and allign build-test.yml with the current test.yml
    • bc357bd Update .github/workflows/release-new-action-version.yml
    • 690ede5 Update .github/ISSUE_TEMPLATE/bug_report.md
    • afbcabf Merge branch 'main' into update-stale-repo
    • e364411 Update name of codeql.yml file
    • 627cef3 fix print outputs step (#859)
    • 975308f Merge pull request #876 from jongwooo/chore/use-cache-in-check-dist
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 0
  • How to select the best result and the best variables from them

    How to select the best result and the best variables from them

    Hi, I just wanted to know how to select the best results from the Playtpus code that I adapted from LINGO software. Because the Playtpus gives me a lot of good results. For example, I wanted ONLY ONE result, and the best result. How I can do that from this code?

    #variaveis
    
    S_preco = 1069.23
    F_preco = 1071.09
    OB_preco = 2006.66
    OR_preco = 2669.21
    B_preco = 2540.47
    S_custo = 533.17
    F_custo = 569.89
    OB_custo = 1384.39
    OR_custo = 1466.34
    B_custo = 2389.89
    
    S_total = 2329278
    
    S_percentoleo = 0.2057
    C_percentoleo = 0.0064
    
    OBF_percentoleo = 0.22
    
    OR_massamolar = 873*0.000001
    M_massamolar = 32*0.000001
    B_massamolar = 292*0.000001
    G_massamolar = 92*0.000001
    
    S_capacidade = 3600000
    OR_capacidade = 367200
    B_capacidade = 887760*(880/1000)
    
    S_demanda = 80638
    F_demanda = 398984
    OB_demanda = 164700
    OR_demanda = 164700
    B_demanda = 77634
    
    from platypus import NSGAII, Problem, Real
    
    def belegundu(vars):
        S_comercio = vars[0]
        F_comercio = vars[1]
        OB_comercio = vars[2]
        OR_comercio = vars[3]
        B_total = vars[4]
        S_insumo = vars[5]
        C_insumo = vars[6]
        OB_total = vars[7]
        OR_total = vars[8]
        OR_biodiesel = vars[9]
        MOL = vars[10]
        M_insumo = vars[11]
        G_comercio = vars[12]
        objs = [1*(S_comercio*S_preco - S_comercio*S_custo + F_comercio*F_preco - F_comercio*F_custo + OB_comercio*OB_preco - OB_comercio*OB_custo + OR_comercio*OR_preco - OR_comercio*OR_custo + B_total*B_preco - B_total*B_custo)]
        constrs = [
            S_total - S_comercio - S_insumo,
            S_insumo - C_insumo - F_comercio - OB_total,
            C_insumo - 0.04*S_insumo,
            OB_total - (F_comercio*OBF_percentoleo)/(1 - OBF_percentoleo),
            OB_total - OB_comercio - OR_total,
            OR_total - OR_comercio - OR_biodiesel,
            OR_biodiesel - MOL*OR_massamolar,
            M_insumo - 3*MOL*M_massamolar,
            B_total - 3*MOL*B_massamolar,
            G_comercio - MOL*G_massamolar,
            S_insumo - S_capacidade,
            OR_total - OR_capacidade,
            B_total - B_capacidade,
            S_comercio - S_demanda,
            F_comercio** - F_demanda,
            OB_comercio - OB_demanda,
            OR_comercio - OR_demanda,
            B_total - B_demanda
        ]
        return objs, constrs
    
    problem = Problem(13, 1, 18)
    problem.types[:] = [Real(0, 2329278), Real(0, 2329278), Real(0, 2329278), Real(0, 2329278), Real(0, 2329278), Real(0, 2329278), Real(0, 2329278), Real(0, 2329278), Real(0, 2329278), Real(0, 2329278), Real(0, 2329278), Real(0, 2329278), Real(0, 2329278)]
    problem.constraints[0] = "==0"
    problem.constraints[1] = "==0"
    problem.constraints[2] = "==0"
    problem.constraints[3] = "==0"
    problem.constraints[4] = "==0"
    problem.constraints[5] = "==0"
    problem.constraints[6] = "==0"
    problem.constraints[7] = "==0"
    problem.constraints[8] = "==0"
    problem.constraints[9] = "==0"
    problem.constraints[10] = "<=0"
    problem.constraints[11] = "<=0"
    problem.constraints[12] = "<=0"
    problem.constraints[13] = ">=0"
    problem.constraints[14] = ">=0"
    problem.constraints[15] = ">=0"
    problem.constraints[16] = ">=0"
    problem.constraints[17] = ">=0"
    problem.function = belegundu
    problem.directions[:] = Problem.MAXIMIZE
    
    algorithm = NSGAII(problem)
    algorithm.run(1000)
    
    feasible_solutions = [s for s in algorithm.result if s.feasible]
    
    for solution in algorithm.result:
        print(solution.objectives)
    
    for solution in algorithm.result:
        print(solution.variables)
    

    Remember that I adapted from this LINGO code:

    MAX = L_soja + L_farelo + L_oleobruto + L_oleorefinado + L_biodiesel;
    
    L_soja = S_comercio*S_preco - S_comercio*S_custo;
    L_farelo = F_comercio*F_preco - F_comercio*F_custo;
    L_oleobruto = OB_comercio*OB_preco - OB_comercio*OB_custo;
    L_oleorefinado = OR_comercio*OR_preco - OR_comercio*OR_custo;
    L_biodiesel = B_total*B_preco - B_total*B_custo;
    
    !variaveis de preço e de custo (em R$/t);
    
    S_preco = 1069.23;
    F_preco = 1071.09;
    OB_preco = 2006.66;
    OR_preco = 2669.21;
    B_preco = 2540.47;
    S_custo = 533.17;
    F_custo = 569.89;
    OB_custo = 1384.39;
    OR_custo = 1466.34;
    B_custo = 2389.89;
    
    !quantidade inicial de soja;
    
    S_total = 2329278; !t;
    
    !produção dos subprodutos;
    
    S_total = S_comercio + S_insumo;
    S_insumo = C_insumo + F_comercio + OB_total; !t;
    C_insumo = 0.04*S_insumo;
    
    S_percentoleo = 0.2057;
    C_percentoleo = 0.0064;
    
    OBF_percentoleo = 0.22;
    OB_total = (F_comercio*OBF_percentoleo)/(1 - OBF_percentoleo);
    
    !balanceamento das massas do óleo;
    
    OB_total = OB_comercio + OR_total;
    
    !balanceamento das massas do óleo refinado;
    
    OR_total = OR_comercio + OR_biodiesel;
    
    !estequiometria da reação do biodiesel (massas molares em kg/mol);
    
    OR_biodiesel = MOL*OR_massamolar;
    M_insumo = 3*MOL*M_massamolar;
    B_total = 3*MOL*B_massamolar;
    G_comercio = MOL*G_massamolar;
    
    SUM_REAGENTES = OR_biodiesel + M_insumo;
    SUM_PRODUTOS = B_total + G_comercio;
    
    !constantes da reação estequiometrica (convertido de g/mol para t/mol) ;
    
    OR_massamolar = 873*0.000001;
    M_massamolar = 32*0.000001;
    B_massamolar = 292*0.000001;
    G_massamolar = 92*0.000001;
    
    !restrições (capacidade maxima);
    
    S_insumo <= S_capacidade;
    OR_total <= OR_capacidade;
    B_total <= B_capacidade;
    
    !restrições (demanda mínima);
    
    S_comercio >= S_demanda;
    F_comercio >= F_demanda;
    OB_comercio >= OB_demanda;
    OR_comercio >= OR_demanda;
    B_total >= B_demanda;
    
    !constantes das restrições (em t);
    
    S_capacidade = 3600000;
    OR_capacidade = 367200;
    B_capacidade = 887760*(880/1000); !Convertido de metros cubicos (m³) para kg, e consequentemente em toneladas;
    
    S_demanda = 80638;
    F_demanda = 398984;
    OB_demanda = 164700;
    OR_demanda = 164700;
    B_demanda = 77634;
    
    opened by RafaHPSUnicamp 3
Releases(1.1.0)
Owner
Project Platypus
A Collection of Libraries for Optimization, Data Analysis, and Decision Making
Project Platypus
A Simple Framwork for CV Pre-training Model (SOCO, VirTex, BEiT)

A Simple Framwork for CV Pre-training Model (SOCO, VirTex, BEiT)

Sense-GVT 14 Jul 07, 2022
CVPR 2021 - Official code repository for the paper: On Self-Contact and Human Pose.

TUCH This repo is part of our project: On Self-Contact and Human Pose. [Project Page] [Paper] [MPI Project Page] License Software Copyright License fo

Lea Müller 45 Jan 07, 2023
PyTorch code for MART: Memory-Augmented Recurrent Transformer for Coherent Video Paragraph Captioning

MART: Memory-Augmented Recurrent Transformer for Coherent Video Paragraph Captioning PyTorch code for our ACL 2020 paper "MART: Memory-Augmented Recur

Jie Lei 雷杰 151 Jan 06, 2023
Clockwork Variational Autoencoder

Clockwork Variational Autoencoders (CW-VAE) Vaibhav Saxena, Jimmy Ba, Danijar Hafner If you find this code useful, please reference in your paper: @ar

Vaibhav Saxena 35 Nov 06, 2022
Attempt at implementation of a simple GAN using Keras

Simple GAN This is my attempt to make a wrapper class for a GAN in keras which can be used to abstract the whole architecture process. Simple GAN Over

Deven96 7 May 23, 2019
CKD - Collaborative Knowledge Distillation for Heterogeneous Information Network Embedding

Collaborative Knowledge Distillation for Heterogeneous Information Network Embed

zhousheng 9 Dec 05, 2022
PPO is a very popular Reinforcement Learning algorithm at present.

PPO is a very popular Reinforcement Learning algorithm at present. OpenAI takes PPO as the current baseline algorithm. We use the PPO algorithm to train a policy to give the best action in any situat

Rosefintech 11 Aug 23, 2021
PyTorch implementation of federated learning framework based on the acceleration of global momentum

Federated Learning with Acceleration of Global Momentum PyTorch implementation of federated learning framework based on the acceleration of global mom

0 Dec 23, 2021
Interactive Visualization to empower domain experts to align ML model behaviors with their knowledge.

An interactive visualization system designed to helps domain experts responsibly edit Generalized Additive Models (GAMs). For more information, check

InterpretML 83 Jan 04, 2023
[PyTorch] Official implementation of CVPR2021 paper "PointDSC: Robust Point Cloud Registration using Deep Spatial Consistency". https://arxiv.org/abs/2103.05465

PointDSC repository PyTorch implementation of PointDSC for CVPR'2021 paper "PointDSC: Robust Point Cloud Registration using Deep Spatial Consistency",

153 Dec 14, 2022
Signals-backend - A suite of card games written in Python

Card game A suite of card games written in the Python language. Features coming

1 Feb 15, 2022
U-Time: A Fully Convolutional Network for Time Series Segmentation

U-Time & U-Sleep Official implementation of The U-Time [1] model for general-purpose time-series segmentation. The U-Sleep [2] model for resilient hig

Mathias Perslev 176 Dec 19, 2022
Codes for SIGIR'22 Paper 'On-Device Next-Item Recommendation with Self-Supervised Knowledge Distillation'

OD-Rec Codes for SIGIR'22 Paper 'On-Device Next-Item Recommendation with Self-Supervised Knowledge Distillation' Paper, saved teacher models and Andro

Xin Xia 11 Nov 22, 2022
[ICSE2020] MemLock: Memory Usage Guided Fuzzing

MemLock: Memory Usage Guided Fuzzing This repository provides the tool and the evaluation subjects for the paper "MemLock: Memory Usage Guided Fuzzing

Cheng Wen 54 Jan 07, 2023
IJON is an annotation mechanism that analysts can use to guide fuzzers such as AFL.

IJON SPACE EXPLORER IJON is an annotation mechanism that analysts can use to guide fuzzers such as AFL. Using only a small (usually one line) annotati

Chair for Sys­tems Se­cu­ri­ty 146 Dec 16, 2022
An unopinionated replacement for PyTorch's Dataset and ImageFolder, that handles Tar archives

Simple Tar Dataset An unopinionated replacement for PyTorch's Dataset and ImageFolder classes, for datasets stored as uncompressed Tar archives. Just

Joao Henriques 47 Dec 20, 2022
SGoLAM - Simultaneous Goal Localization and Mapping

SGoLAM - Simultaneous Goal Localization and Mapping PyTorch implementation of the MultiON runner-up entry, SGoLAM: Simultaneous Goal Localization and

10 Jan 05, 2023
The official implementation of CVPR 2021 Paper: Improving Weakly Supervised Visual Grounding by Contrastive Knowledge Distillation.

Improving Weakly Supervised Visual Grounding by Contrastive Knowledge Distillation This repository is the official implementation of CVPR 2021 paper:

9 Nov 14, 2022
MicroNet: Improving Image Recognition with Extremely Low FLOPs (ICCV 2021)

MicroNet: Improving Image Recognition with Extremely Low FLOPs (ICCV 2021) A pytorch implementation of MicroNet. If you use this code in your research

Yunsheng Li 293 Dec 28, 2022
[ICCV 2021] Deep Hough Voting for Robust Global Registration

Deep Hough Voting for Robust Global Registration, ICCV, 2021 Project Page | Paper | Video Deep Hough Voting for Robust Global Registration Junha Lee1,

57 Nov 28, 2022