5

मैं एक त्रुटि हो रही है मेरी C++/gurobi फ़ाइल में असमर्थ:gurobi - त्रुटि कोड = 10004 विशेषता पुनः प्राप्त करने के 'एक्स'

त्रुटि कोड = 10004 विशेषता पुनः प्राप्त करने के 'एक्स'

मुझे लगता है कि पढ़ने के लिए असमर्थ लेबल के साथ ऐसा कुछ हो सकता है? लेकिन मुझे नहीं पता कि कोई समस्या कैसे है। यह कुछ इनपुट फ़ाइलों के लिए काम करता है, लेकिन दूसरों के लिए नहीं। इसलिए मैंने संलग्नक में एक खिलौना फ़ाइल, t5.txt बनाया है। यह फ़ाइल काम नहीं करती है, लेकिन अंतिम कॉलम को हटाने और 8 से 7 सेटिंग को ठीक करने के लिए। मैं परेशान हूं ...

नीचे model.write का आउटपुट है। सब कुछ समझ में आता है, कोई विचार क्या मैं गलत कर रहा हूँ? जब भी मैं एक model.write (test.sol) करते हैं, कार्यक्रम बंद हो जाता है, इसलिए वहाँ कुछ समाधान के साथ गलत>

संलग्नक हो रहा है: main.cpp ->https://dl.dropboxusercontent.com/u/13564139/main.cpp

input.txt - >https://dl.dropboxusercontent.com/u/13564139/t5.txt

Maximize 
    15 student_has_projects4.1 
Subject To 
R0: student_has_projects0.0 + student_has_projects1.0 
    + student_has_projects2.0 + student_has_projects3.0 
    + student_has_projects4.0 + student_has_projects5.0 
    + student_has_projects6.0 + student_has_projects7.0 <= 4 
R1: student_has_projects1.0 + student_has_projects2.0 >= 1 
R2: student_has_projects2.0 + 2 student_has_projects5.0 <= 2 
R3: student_has_projects2.0 + 2 student_has_projects5.0 >= 1 
R4: student_has_projects0.0 + student_has_projects3.0 
    + student_has_projects4.0 + student_has_projects6.0 
    + student_has_projects7.0 >= 1 
R5: student_has_projects2.0 + student_has_projects5.0 <= 1 
R6: student_has_projects0.1 + student_has_projects1.1 
    + student_has_projects2.1 + student_has_projects3.1 
    + student_has_projects4.1 + student_has_projects5.1 
    + student_has_projects6.1 + student_has_projects7.1 <= 4 
R7: student_has_projects1.1 + student_has_projects2.1 >= 1 
R8: student_has_projects2.1 + 2 student_has_projects5.1 <= 2 
R9: student_has_projects2.1 + 2 student_has_projects5.1 >= 1 
R10: student_has_projects0.1 + student_has_projects3.1 
    + student_has_projects4.1 + student_has_projects6.1 
    + student_has_projects7.1 >= 1 
R11: student_has_projects2.1 + student_has_projects5.1 <= 1 
R12: student_has_projects0.2 + student_has_projects1.2 
    + student_has_projects2.2 + student_has_projects3.2 
    + student_has_projects4.2 + student_has_projects5.2 
    + student_has_projects6.2 + student_has_projects7.2 <= 4 
R13: student_has_projects1.2 + student_has_projects2.2 >= 1 
R14: student_has_projects2.2 + 2 student_has_projects5.2 <= 2 
R15: student_has_projects2.2 + 2 student_has_projects5.2 >= 1 
R16: student_has_projects0.2 + student_has_projects3.2 
    + student_has_projects4.2 + student_has_projects6.2 
    + student_has_projects7.2 >= 1 
R17: student_has_projects2.2 + student_has_projects5.2 <= 1 
R18: student_has_projects0.0 + student_has_projects0.1 
    + student_has_projects0.2 = 1 
R19: student_has_projects1.0 + student_has_projects1.1 
    + student_has_projects1.2 = 1 
R20: student_has_projects2.0 + student_has_projects2.1 
    + student_has_projects2.2 = 1 
R21: student_has_projects3.0 + student_has_projects3.1 
    + student_has_projects3.2 = 1 
R22: student_has_projects4.0 + student_has_projects4.1 
    + student_has_projects4.2 = 1 
R23: student_has_projects5.0 + student_has_projects5.1 
    + student_has_projects5.2 = 1 
R24: student_has_projects6.0 + student_has_projects6.1 
    + student_has_projects6.2 = 1 
R25: student_has_projects7.0 + student_has_projects7.1 
    + student_has_projects7.2 = 1 
Bounds 
Binaries 
student_has_projects0.0 student_has_projects0.1 student_has_projects0.2 
student_has_projects1.0 student_has_projects1.1 student_has_projects1.2 
student_has_projects2.0 student_has_projects2.1 student_has_projects2.2 
student_has_projects3.0 student_has_projects3.1 student_has_projects3.2 
student_has_projects4.0 student_has_projects4.1 student_has_projects4.2 
student_has_projects5.0 student_has_projects5.1 student_has_projects5.2 
student_has_projects6.0 student_has_projects6.1 student_has_projects6.2 
student_has_projects7.0 student_has_projects7.1 student_has_projects7.2 
End 

उत्तर

6

मुद्दा यह है कि अपने एल.पी. उदाहरण अव्यवहार्य है तो कॉल .optimize करने के लिए() एक अव्यवहार्य स्थिति में परिणाम है। आपके कोड से

model.write("test2.lp"); 
model.optimize(); 
model.write("forum2.sol"); 

if(model.get(GRB_IntAttr_Status) != GRB_OPTIMAL){ 
    cout << "niet optimaal " << endl; 
} 

आप सफलता की जांच करने से पहले एक .sol फ़ाइल लिख रहे हैं। एक एसओएस फ़ाइल लिखते समय गुरुबी को चर से 'एक्स' गुण प्राप्त होते हैं। यदि अनुकूलन विफल रहता है, तो 'एक्स' विशेषताएँ उपलब्ध नहीं हैं और एक अपवाद फेंक दिया जाता है। आपको यह सुनिश्चित करना चाहिए कि एक एसओएस फ़ाइल लिखने से पहले गुरोबी का समाधान हो, या 'एक्स', 'पी' और 'ओब्जवल' सहित कई विशेषताओं को प्राप्त करें। ऑप्टिकल status codes आपको आश्वासन देता है कि एक उपलब्ध समाधान है, लेकिन SUBOPTIMAL जैसे कोड यह भी इंगित करते हैं कि एक समाधान उपलब्ध है और TIME_LIMIT, NODE_LIMIT जैसे अन्य लोगों का मतलब है कि कोई समाधान उपलब्ध हो सकता है। एक निश्चित संकेत प्राप्त करने के लिए आप एक समाधान उपलब्ध कराने के लिए SolCount विशेषता प्राप्त कर सकते हैं।

आपकी समस्या का उदाहरण अक्षम है क्योंकि बाधाएं (आर 1, आर 7, आर 13 आपको छात्रों और 1 के लिए कम से कम 3 परियोजनाओं की आवश्यकता है, लेकिन बाधाओं (आर 1 9, आर 20) का अर्थ है कि उनके पास बिल्कुल 1 परियोजना हो सकती है। आप इसे देख सकते हैं आईआईएस solver का उपयोग करके। इंटरैक्टिव gurobi में आप प्राप्त कर प्राप्त कर सकते हैं एक Irreducible Inconsistent Subsystem

m = read("test2.lp") 
m.optimize() 
m.computeIIS() 
m.write("test2.ilp") 
+0

मैं सिर्फ लिखने कि मैंने पाया कि वे अव्यवहार्य कहाँ। कुछ सुधार (यानी डमी उदाहरण) यह संभव बनाने के लिए जोड़ा गया था। नहीं यद्यपि वास्तव में त्रुटि संदेश स्पष्ट है। – dorien

संबंधित मुद्दे