<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[CPLEX eingebunden in C++ mit Visual Studio 2013: Werteausgabe als Matrix]]></title><description><![CDATA[<p>Hallo Leute,</p>
<p>ich habe eine Frage zur Ausgabe meiner zweidimensionalen binären Entscheidungsvariablen x[i][j]:</p>
<pre><code>IloArray&lt;IloNumVarArray&gt; x(env, n+1);
	for (int i = 0; i &lt; n+1; i++) {

		x[i] = IloNumVarArray(env, n+1, 0, 1, ILOBOOL);
	}
</code></pre>
<p>Wie kann ich nach dem Lösen des Problems x[i][j] als Matrix ausgeben lassen, in der Zeilen [i] und Spalten [j] mit dem jeweiligen Werten beschriftet sind?</p>
<p>Bisher sieht es bei mir so aus:</p>
<pre><code>IloCplex cplex(env);
	cplex.extract(model);
	bool solved = cplex.solve(); 

	if (solved){

            cout &lt;&lt; endl;
	    cout &lt;&lt; &quot;x[i][j]&quot; &lt;&lt; endl;
            for (int i = 0; i &lt; n; i++){

		for (int j = 1; j &lt; n+1; j++){

		   cout &lt;&lt; &quot;[&quot; &lt;&lt; i &lt;&lt; &quot;]&quot; &lt;&lt; cplex.getValue(x[i][j]) &lt;&lt; &quot; &quot;;
		}

		cout &lt;&lt; endl;
	    }
</code></pre>
<p>Das ergibt zwar als Ausgabe eine Matrix mit den Werten 0 und 1, jedoch muss ich Zeile und Spalte immer abzählen, anstatt dass die jeweiligen Spalten und Zeilen beschriftet sind. Weiß jemand eine bessere Lösung?</p>
<p>Vielen Dank im Voraus!</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/337709/cplex-eingebunden-in-c-mit-visual-studio-2013-werteausgabe-als-matrix</link><generator>RSS for Node</generator><lastBuildDate>Fri, 17 Apr 2026 19:44:02 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/337709.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 22 Apr 2016 14:32:02 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to CPLEX eingebunden in C++ mit Visual Studio 2013: Werteausgabe als Matrix on Fri, 22 Apr 2016 14:33:08 GMT]]></title><description><![CDATA[<p>Hallo Leute,</p>
<p>ich habe eine Frage zur Ausgabe meiner zweidimensionalen binären Entscheidungsvariablen x[i][j]:</p>
<pre><code>IloArray&lt;IloNumVarArray&gt; x(env, n+1);
	for (int i = 0; i &lt; n+1; i++) {

		x[i] = IloNumVarArray(env, n+1, 0, 1, ILOBOOL);
	}
</code></pre>
<p>Wie kann ich nach dem Lösen des Problems x[i][j] als Matrix ausgeben lassen, in der Zeilen [i] und Spalten [j] mit dem jeweiligen Werten beschriftet sind?</p>
<p>Bisher sieht es bei mir so aus:</p>
<pre><code>IloCplex cplex(env);
	cplex.extract(model);
	bool solved = cplex.solve(); 

	if (solved){

            cout &lt;&lt; endl;
	    cout &lt;&lt; &quot;x[i][j]&quot; &lt;&lt; endl;
            for (int i = 0; i &lt; n; i++){

		for (int j = 1; j &lt; n+1; j++){

		   cout &lt;&lt; &quot;[&quot; &lt;&lt; i &lt;&lt; &quot;]&quot; &lt;&lt; cplex.getValue(x[i][j]) &lt;&lt; &quot; &quot;;
		}

		cout &lt;&lt; endl;
	    }
</code></pre>
<p>Das ergibt zwar als Ausgabe eine Matrix mit den Werten 0 und 1, jedoch muss ich Zeile und Spalte immer abzählen, anstatt dass die jeweiligen Spalten und Zeilen beschriftet sind. Weiß jemand eine bessere Lösung?</p>
<p>Vielen Dank im Voraus!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2493765</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2493765</guid><dc:creator><![CDATA[Iggy90]]></dc:creator><pubDate>Fri, 22 Apr 2016 14:33:08 GMT</pubDate></item><item><title><![CDATA[Reply to CPLEX eingebunden in C++ mit Visual Studio 2013: Werteausgabe als Matrix on Mon, 25 Apr 2016 07:16:36 GMT]]></title><description><![CDATA[<p>Dieser Thread wurde von Moderator/in <a href="http://www.c-plusplus.net/forum/u100590" rel="nofollow">Martin Richter</a> aus dem Forum <a href="http://www.c-plusplus.net/forum/f1" rel="nofollow">MFC (Visual C++)</a> in das Forum <a href="http://www.c-plusplus.net/forum/f15" rel="nofollow">C++ (alle ISO-Standards)</a> verschoben.</p>
<p>Im Zweifelsfall bitte auch folgende Hinweise beachten:<br />
<a href="http://www.c-plusplus.net/forum/39405" rel="nofollow">C/C++ Forum :: FAQ - Sonstiges :: Wohin mit meiner Frage?</a></p>
<p><em>Dieses Posting wurde automatisch erzeugt.</em></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2493990</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2493990</guid><dc:creator><![CDATA[C++ Forumbot]]></dc:creator><pubDate>Mon, 25 Apr 2016 07:16:36 GMT</pubDate></item><item><title><![CDATA[Reply to CPLEX eingebunden in C++ mit Visual Studio 2013: Werteausgabe als Matrix on Mon, 25 Apr 2016 07:34:39 GMT]]></title><description><![CDATA[<p>Ich verstehe dein Problem nicht, kannst du das näher erläutern? Wenn du Zeilen- und Spaltennummer mit ausgeben möchtest, dann tu das doch. Derzeit gibst du die Zeile schließlich schon mit aus, was ist das Problem bei den Spalten?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2493991</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2493991</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Mon, 25 Apr 2016 07:34:39 GMT</pubDate></item></channel></rss>