Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 333375
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T09:57:19+00:00 2026-05-12T09:57:19+00:00

I use Python 2.5. I am passing bounds to the cobyla optimisation: import numpy

  • 0

I use Python 2.5.

I am passing bounds to the cobyla optimisation:

import numpy 
from numpy import asarray

Initial = numpy.asarray [2, 4, 5, 3]       # Initial values to start with

#bounding limits (lower,upper) - for visualizing

#bounds = [(1, 5000), (1, 6000), (2, 100000), (1, 50000)] 

# actual passed bounds

b1 = lambda  x: 5000 - x[0]      # lambda x: bounds[0][1] - Initial[0]

b2 = lambda  x: x[0] - 2.0       # lambda x: Initial[0] - bounds[0][0]

b3 = lambda  x: 6000 - x[1]      # same as above

b4 = lambda  x: x[1] - 4.0

b5 = lambda  x: 100000 - x[2]

b6 = lambda  x: x[2] - 5.0

b7 = lambda  x: 50000 - x[3]

b8 = lambda  x: x[3] - 3.0

b9 = lambda  x: x[2] >  x[3]  # very important condition for my problem!


opt= optimize.fmin_cobyla(func,Initial,cons=[b1,b2,b3,b4,b5,b6,b7,b8,b9,b10],maxfun=1500000)

Based on the initial values Initial and as per/within the bounds b1 to b10 the values are passed to opt(). But the values are deviating, especially with b9. This is a very important bounding condition for my problem!

“The value of x[2] passed to my function opt() at every iteration must be always greater than x[3]” — How is it possible to achieve this?

Is there anything wrong in my bounds (b1 to b9) definition ?

Or is there a better way of defining of my bounds?

Please help me.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T09:57:20+00:00Added an answer on May 12, 2026 at 9:57 am

    fmin_cobyla() is not an interior point method. That is, it will pass points that are outside of the bounds (“infeasible points”) to the function during the course of the optmization run.

    On thing that you will need to fix is that b9 and b10 are not in the form that fmin_cobyla() expects. The bound functions need to return a positive number if they are within the bound, 0.0 if they are exactly on the bound, and a negative number if they are out of bounds. Ideally, these functions should be smooth. fmin_cobyla() will try to take numerical derivatives of these functions in order to let it know how to get back to the feasible region.

    b9 = lambda x: x[2] - x[3]
    

    I’m not sure how to implement b10 in a way that fmin_cobyla() will be able to use, though.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 165k
  • Answers 165k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer There are a couple of variants of a rename command,… May 12, 2026 at 12:33 pm
  • Editorial Team
    Editorial Team added an answer There is currently no way to build CLS-compliant assemblies from… May 12, 2026 at 12:33 pm
  • Editorial Team
    Editorial Team added an answer You might want to look at Google Protocol Buffers or… May 12, 2026 at 12:33 pm

Related Questions

I've been recently asked to learn some MATLAB basics for a class. What does
I am using Python 2.5.2. How can I tell whether it is CPython or
With django 1.0.2 and Python 2.5, when I use the keyword DateField.input_formats , I
I am using mod-wsgi with django, and in django I use pylucene to do
I am having an issue with IEMobile accessing my site. A certain redirect I

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.