Giter Club home page Giter Club logo

Comments (3)

dhadka avatar dhadka commented on August 10, 2024 1

Hi,

It seems it doesn't like using a list to input the constraints. I'll need to investigate more how to fix this, but for now the following should work:

    problem.constraints[0] = "<=0"
    problem.constraints[1] = ">=0"

I also changed these two lines to get the example working:

    x = vars[0]
    y = vars[1]

Full version:

from platypus import NSGAII, Problem, Real

def telegundu(vars):
    x = vars[0]
    y = vars[1]
    return [4*x**2 + 4*y**2,(x-5)**2+(y-5)**2], [(x-5)**2+y**2-25, (x-8)**2+(y+3)**2-7.7]

problem = Problem(2, 2, 2)
problem.types[:] = [Real(0, 5), Real(0, 3)]
problem.constraints[0] = "<=0"
problem.constraints[1] = ">=0"
problem.function = telegundu

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

for solution in algorithm.result:
    print(solution.objectives)

from platypus.

tuli01 avatar tuli01 commented on August 10, 2024 1

Thank you

from platypus.

dhadka avatar dhadka commented on August 10, 2024

Fixed in 04e6283. You can now pass in constraints as an array: problem.constraints[:] = ["<=0", ">=0"].

from platypus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.