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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T03:22:50+00:00 2026-06-03T03:22:50+00:00

A solver project I am working on (C#) requires to test if there is

  • 0

A solver project I am working on (C#) requires to test if there is a solution, regardless of quality, or not to a problem where some of the inputs fall within some pre-defined range of real numbers.

I put together the following example that contains one constraint representing a simple equality test between a value (a Parameter type) and an equation comprised of two variables (Decision types).

        const double DESIRED_OUTPUT_VALUE = -2.5;

        SolverContext solver = SolverContext.GetContext();
        Model model = solver.CreateModel();

        //Defined a value to be tested against
        Parameter output = new Parameter(Domain.Real, "output");
        output.SetBinding(DESIRED_OUTPUT_VALUE);

        //Defined a range between 1 & 10 for the input variables.
        Domain inputDomain = Domain.RealRange(1, 10);
        Decision inputA = new Decision(inputDomain, "inputA");
        Decision inputB = new Decision(inputDomain, "inputB");

        model.AddDecision(inputA);
        model.AddDecision(inputB);
        model.AddParameter(output);

        //The constraint, which given the value of output currently is not solvable.
        Constraint constraint = model.AddConstraint("result", output == inputA / inputB);

        /*Expected that the solver would report back quickly that this is no feasable solution.
         *However instead it just sits there with a blank screen... 
         */
        Solution solution = solver.Solve();
        Report report = solution.GetReport();
        Console.WriteLine(report);
        Console.ReadLine();

What I have observed is that if the constraint is changed so that that there is no solution, and the equation represented therein is a division or multiplication, the solver seems to stall, not giving any feedback as to whether it is still solving or not.

I suspect this stalling-like behaviour is to do with the fact the solver is dealing with real numbers and is in the midst of some exhaustive search, however if the constraint is altered so that there is a known solution it works very quickly.

Having scoured various forums I am still not sure what could be causing this behaviour or, given this is my first experience using Microsoft Solver Foundation, if my implementation approach is the correct one to take.

Has anyone else experienced this issue or indeed has a solution?

d.

  • 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-03T03:22:51+00:00Added an answer on June 3, 2026 at 3:22 am

    The solver that is chosen by Solver Foundation depends on a number of factors. A big factor is how you use the Decisions in your goals and constraints. In this case, you are dividing two decisions, which means that a very general solver needs to be used.

    You’ll have much better success if you can write your model so that the goals and constraints are linear in the Decision objects. I realize this is not always possible, but in this specific case, it can: change output == inputA / inputB to inputB * output == inputA.

    I think this should help.
    Nate

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

Sidebar

Related Questions

Possible Duplicate: Project Euler, Problem 10 java solution not working So, I'm attempting to
A project I'm working on requires me to solve the following problem for a
I am currently working on a project that requires to solve the following problem:
The project I am working on requires a whole bunch of queries towards a
Our project is working within fairly close quarters code-wise (a lot of changes happening
I'm working on a project that requires Kendo UI. We are currently working with
I am currently working on a project that requires the use of SVN on
I am trying to build a Sudoku solver for a project I am working
I'm refactoring some code in a project I'm working on and I ran into
Working on a problem that requires a GA. I have all of that working

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.