question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

unknown solution status dependent on constraint list ordering

See original GitHub issue

I just ran into some behavior I really don’t understand. These are the constraints for my combustor model, and everything works fine with them.

           constraints = [
                #flow through combustor
                Pt4 == pib * Pt3,   #B.145
                ht4 == Cpc * Tt4,

                TCS([f*hf >= (1-ac)*ht4-(1-ac)*ht3+Cpfuel*f*(Tt4-Ttf)]),

                #making f+1 GP compatible --> needed for convergence
                SignomialEquality(fp1,f+1),

                ht41 == Cpc * Tt41,
                ]

            constraints.extend([
                #compute Tt41...mixing causes a temperature drop
                #had to include Tt4 here to prevent it from being pushed down to zero
                TCS([ht41 <= ((1-ac)*ht4 +ac*ht3+Cpfuel*f*(Tt4-Ttf) + Cpfuel*Ttf*f)/fp1]),

                #comptue the rest of the station 4.1 variables
                SignomialEquality(fp1*u41, (u4a*(1-ac)+f*u4a+ac*uc)),          

                #this is a stagnation relation...need to fix it to not be signomial
                TCS([T41 >= Tt41-.5*(u41**2)/Cpc]),
                #here we assume no pressure loss in mixing so P41=P4a
                Pt41 == P4a*(Tt41/T41)**(1.313/.313),
                #compute station 4a quantities, assumes a gamma value of 1.313 (air @ 1400K)
                u4a == M4a*((1.313*R*Tt4)**.5)/hold4a,
                uc == ruc*u4a,
                P4a == Pt4*hold4a**(-1.313/.313),
                ])

however, these constraints cause the model to return unknown

           constraints = [
                #flow through combustor
                Pt4 == pib * Pt3,   #B.145
                ht4 == Cpc * Tt4,

                #making f+1 GP compatible --> needed for convergence
                SignomialEquality(fp1,f+1),

                ht41 == Cpc * Tt41,
                ]

            constraints.extend([
               TCS([f*hf >= (1-ac)*ht4-(1-ac)*ht3+Cpfuel*f*(Tt4-Ttf)]),
                #compute Tt41...mixing causes a temperature drop
                #had to include Tt4 here to prevent it from being pushed down to zero
                TCS([ht41 <= ((1-ac)*ht4 +ac*ht3+Cpfuel*f*(Tt4-Ttf) + Cpfuel*Ttf*f)/fp1]),

                #comptue the rest of the station 4.1 variables
                SignomialEquality(fp1*u41, (u4a*(1-ac)+f*u4a+ac*uc)),          

                #this is a stagnation relation...need to fix it to not be signomial
                TCS([T41 >= Tt41-.5*(u41**2)/Cpc]),
                #here we assume no pressure loss in mixing so P41=P4a
                Pt41 == P4a*(Tt41/T41)**(1.313/.313),
                #compute station 4a quantities, assumes a gamma value of 1.313 (air @ 1400K)
                u4a == M4a*((1.313*R*Tt4)**.5)/hold4a,
                uc == ruc*u4a,
                P4a == Pt4*hold4a**(-1.313/.313),
                ])

the only difference is that this constraint TCS([f*hf >= (1-ac)*ht4-(1-ac)*ht3+Cpfuel*f*(Tt4-Ttf)]), was moved from the constraints = [] to constraints.extend([])…any idea what’s going on here?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:34 (26 by maintainers)

github_iconTop GitHub Comments

1reaction
bqpdcommented, Sep 7, 2016

Try it on the fastsub or setsubs branches, it should get a little bit faster. Once you’re happy it’s working again we can close this issue…

0reactions
mayorkcommented, May 16, 2017

I think Ned is right that it was x0

Read more comments on GitHub >

github_iconTop Results From Across the Web

Source code for picos.modeling.problem - GitLab
_constraints = OrderedDict() #: Contains lists of constraints added together, all in order. self.
Read more >
How to determine the solution of a problem by looking at its ...
By looking at the constraints of a problem, we can often "guess" the solution. ... Search (Finding maximum/minimum element in a 1D array),...
Read more >
Could this CP-SAT model be faster? - Stack Overflow
In my c# model I reformulated the assignment dependency constraint as follows: for (int a = 0; a < num_assignments; a++) { Assignment ......
Read more >
Advanced Features — CVXPY 1.2 documentation
This section of the tutorial covers features of CVXPY intended for users with advanced knowledge of convex optimization. We recommend Convex Optimization by ......
Read more >
Source code for docplex.cp.solution
None if unknown. lvars: Ordered list of interval variable solutions that are in this sequence (objects of class :class:`CpoIntervalVarSolution`), or list of ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found