Solving does not complete

Réponse proposée Solving does not complete

  • mardi 20 décembre 2011 15:50
     
      A du code

    I'm currently using Solver Foundation on a project with some 3 Goals and around 25 Decisions. I am quite new to using OML and this whole area. We initially create "the model" in excel and then deploy OML to c# which is then used within our application.

    My issue is that when solving a particular set of values i get a quick solve (as seen below in the solver report) around 27 seconds in total. But for some cases the solve doesn't seem to finish, even if i leave it for 12 hours or so.

    Even if i ask for a infeasibility report it does not generate one and just continues 'to solve'. The problem is i cannot see a way for MSF to tell me what issues it is having.

    Has anyone encountered this kind of problem or does anyone know what i'm doing wrong or what i can do to give it a helping hand?

    I have read a bit about Degeneracy so is there a way of relaxing the constraints or at least taking the first solve found if it finds a multitude of solutions?

    Sorry for being a vague in the details of the project, constraints, parameters, etc but any suggestions would be indeed very helpful

    ===Solver Foundation Service Report===
    Date: 20/12/2011 12:52:09
    Version: Microsoft Solver Foundation 3.0.2.10889 Standard Edition
    Model Name: DefaultModel
    Capabilities Applied: LP
    Solve Time (ms): 1217
    Total Time (ms): 27106
    Solve Completion Status: Optimal
    Solver Selected: Microsoft.SolverFoundation.Solvers.SimplexSolver
    Directives:
    Microsoft.SolverFoundation.Services.Directive
    Algorithm: Primal
    Arithmetic: Hybrid
    Variables: 8603 -> 2397 + 1837
    Rows: 8154 -> 1906
    Nonzeros: 19148
    Eliminated Slack Variables: 69
    Pricing (exact): SteepestEdge
    Pricing (double): SteepestEdge
    Basis: Slack
    Pivot Count: 2081
    Phase 1 Pivots: 1459 + 27
    Phase 2 Pivots: 533 + 62
    Factorings: 74 + 13
    Degenerate Pivots: 1690 (81.21 %)
    Branches: 0

Toutes les réponses

  • samedi 14 avril 2012 04:09
     
     

    Hi,

    We are also facing a similar problem as yours. 

    If you have found the solution for it , could you please post it here. It would be of enormous help to us.

    -Thanks,

    Rahul.

  • samedi 14 avril 2012 21:07
     
     Réponse proposée

    I recommend changing the default solver to Gurobi (included with Solver Foundation). Instructions for doing so are here:

    http://msdn.microsoft.com/en-us/library/gg278365(v=vs.93).aspx

    You'll need to change the version number according to your solver foundation installation.

    Nate

    • Proposé comme réponse Nate Brixius samedi 14 avril 2012 21:07
    •  
  • lundi 16 avril 2012 10:23
     
     

    Hi Nate ,

    Thanks for the response.

    In my case , the solve method works fine with some data and fails(keeps on running for eternity) for other.

    But when i change the failed data to have more decimal places . it runs fine. and the vice-versa too.

    Do you know how the solve method responds to data with decimal places(double numbers).

    I am getting it to work by changing the number of decimal places, but i am unable to find the right format which will work for the complete dataset.

    -Rahul.

  • mercredi 18 avril 2012 14:27
     
     

    I am using a Microsoft.Solver.Foundation.dll(version: 3.0) calling through .Net application, my query is :

    Is it possible to respond to the solving event from the solver without using the Microsoft Solver Foundation service.

    My objective is to cancel the solving process if the solver is not able to solve the model and continue the further logic in the .net application.

    Thanks,

    Bhaskar


  • mercredi 18 avril 2012 14:37
     
     

    I am using a Microsoft.Solver.Foundation.dll(version: 3.0) calling through .Net application, my query is :

    Is it possible to respond to the solving event from the solver without using the Microsoft Solver Foundation service.

    My objective is to cancel the solving process if the solver is not able to solve the model and continue the further logic in the .net application.

    Here is my function :

     public CompactQuasiNewtonSolver solveModel()
            {

                try
                {
                    solverParams = new CompactQuasiNewtonSolverParams();
                    solver = new CompactQuasiNewtonSolver();
                                                   
                    int vidRow, vidMean, vidVolatility, vidTrans, vidMult;
                    solver.AddVariable(null, out vidMean);
                    solver.AddVariable(null, out vidVolatility);
                    solver.AddVariable(null, out vidMult);

                    if (hasTrans)
                    {
                        solver.AddVariable(null, out vidTrans);
                    }

                    solver.AddRow(null, out vidRow);
                    solver.AddGoal(vidRow, 0, false);


                    solver.SetValue(1, initMean);
                    solver.SetValue(2, initVol);
                    solver.SetValue(3, initMult);

                    


                    if (hasTrans)
                    {
                        solver.SetValue(4, initTrans);
                    }

                    solver.FunctionEvaluator = RSquaredCallback;
                    solver.GradientEvaluator = RSquaredGradient;
                                   
                    solver.Solve(solverParams);

                }
                catch(Exception ex)
                {
                }

                return solver;
            }

    Thanks,

    Bhaskar