Esempio n. 1
0
        private void UpdateSolution(mosek.Task task)
        {
            double[]       xx  = new double[VariableCount];
            double[]       xc  = new double[RowCount];
            mosek.stakey[] skx = new mosek.stakey[VariableCount];
            mosek.stakey[] skc = new mosek.stakey[RowCount];
            mosek.soltype  sol;

            primalObjIsdef = InitSoltypeDefined(task, out solDefined);

            if (GetSoltypeDefined(out sol))
            {
                task.getsolutionstatus(
                    sol,
                    out prosta,
                    out solsta);
            }

            if (GetSoltypeDefined(out sol))
            {
                task.getsolutionstatuskeyslice(
                    mosek.accmode.var,
                    sol,
                    0,
                    VariableCount,
                    skx);

                task.getsolutionstatuskeyslice(
                    mosek.accmode.con,
                    sol,
                    0,
                    RowCount,
                    skc);

                task.getsolutionslice(
                    sol,
                    mosek.solitem.xx,
                    0,
                    VariableCount,
                    xx);

                task.getsolutionslice(
                    sol,
                    mosek.solitem.xc,
                    0,
                    RowCount,
                    xc);


                UpdateSolutionPart(RowIndices, xc, skc);
                UpdateSolutionPart(VariableIndices, xx, skx);
            }

            if (GetSoltypeDefined(out sol))
            {
                primalObjIsdef = true;
                primalObj      = task.getprimalobj(sol);
            }
        }