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 7785243
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T20:13:29+00:00 2026-06-01T20:13:29+00:00

I am solving large optimization problems with CPLEX Java API. Currently I just IloCplex

  • 0

I am solving large optimization problems with CPLEX Java API. Currently I just

IloCplex cplex = new IloCplex();
... add lots of variables and constraints ...
cplex.solve();
cplex.end();

This works great, but I repeat the process frequently where I am just changing co-efficients. Each time I repeat I create a new cplex object and re-create all the variables.

Is there a more efficient way to do this? The IBM documentation has language like ‘adding the model to the instance of the model’, which sounds weird, but I thought it was hinting at being able to re-use things.

Any suggestions from more experienced users would be great. Thanks.

  • 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-06-01T20:13:30+00:00Added an answer on June 1, 2026 at 8:13 pm

    If you just want to change coefficients of constraints (or those of the objective function), you can modify the coefficients on the existing IloCplex object. You shouldn’t create a model from scratch.

    retval = cplex.solve();
    // verify that the solve was successful
    
    // change coeficients on constraints (or in the objective)
    cplex.setLinearCoef(constraint, newCoef, variable);
    cplex.setLinearCoef(objective, newObjCoef, variable);
    
    // change right bounds on constraints
    constraint.setBounds(newLB, newUB);
    
    // change variable bounds
    var.setBounds(newLB, newUB);
    
    retval = cplex.solve();
    // verify the solve
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need some help in solving this problem. We have a large amount of
After solving countless problems with the hg-fast-export tool on Windows (from finicky python version
I'm currently trying to analyze large data sets (40 000+ data points) with matlab.
I'm currently working on a game engine in java, however I'm having preformance issues
I am solving the question about downloading a large amounts of picture from the
I am solving UVa site problems, I have a problem that I must sort
Ok, I'm hoping the community at large will aid us in solving a workplace
In the process of solving a larger problem I wrote a new class method
While solving exercises from the K&R C book, I stumbled upon the exercise 2.1.
I'm solving UVA's Edit Step Ladders on an uva sub-site named programming-challenges.com, but since

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.